[Zope3-checkins] CVS: Zope3/src/zope/app/workflow - instance.py:1.14

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Apr 15 18:11:24 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/workflow
In directory cvs.zope.org:/tmp/cvs-serv8946/src/zope/app/workflow

Modified Files:
	instance.py 
Log Message:


Added helper function 'createProcessInstance(context, name)', where name is a
process definition name.




=== Zope3/src/zope/app/workflow/instance.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/workflow/instance.py:1.13	Sat Mar 13 18:01:15 2004
+++ Zope3/src/zope/app/workflow/instance.py	Thu Apr 15 18:11:24 2004
@@ -15,15 +15,15 @@
 
 $Id$
 """
-__metaclass__ = type
-
 from types import StringTypes
 from persistent.dict import PersistentDict
 from zope.proxy import removeAllProxies
 
+from zope.app import zapi
 from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
-from zope.app.workflow.interfaces \
-     import IProcessInstance, IProcessInstanceContainer
+from zope.app.servicenames import Utilities
+from zope.app.workflow.interfaces import IProcessInstance, IProcessDefinition
+from zope.app.workflow.interfaces import IProcessInstanceContainer
 
 from zope.interface import implements
 
@@ -47,11 +47,19 @@
     ## should probably have a method "getProcessDefinition"
 
 
+def createProcessInstance(context, name):
+    """Helper function to create a process instance from a process definition
+    name."""
+    utils = zapi.getService(context, Utilities)
+    pd = utils.getUtility(IProcessDefinition, name)
+    return pd.createProcessInstance(name)
+
+
 _marker = object()
 
 WFKey = "zope.app.worfklow.ProcessInstanceContainer"
 
-class ProcessInstanceContainerAdapter:
+class ProcessInstanceContainerAdapter(object):
 
     implements(IProcessInstanceContainer)
 




More information about the Zope3-Checkins mailing list