[Zope3-checkins] CVS: Packages3/workflow - definition.py:1.4 globalimportexport.py:1.6 service.py:1.8

Ulrich Eck ueck@net-labs.de
Wed, 9 Apr 2003 14:36:01 -0400


Update of /cvs-repository/Packages3/workflow
In directory cvs.zope.org:/tmp/cvs-serv18601

Modified Files:
	definition.py globalimportexport.py service.py 
Log Message:
added a parameter definition_name to createProcessInstance
that eases the implementation alot and avoids some Wrapper-hacks
updated all tests accordingly

added canImport implementation to stateful/xmlimportexport and tests

cleanup a bit


=== Packages3/workflow/definition.py 1.3 => 1.4 ===
--- Packages3/workflow/definition.py:1.3	Fri Feb  7 10:29:21 2003
+++ Packages3/workflow/definition.py	Wed Apr  9 14:35:30 2003
@@ -37,7 +37,7 @@
     # Implementation methods for interface
     # zope.app.interfaces.workflow.IProcessDefinition
 
-    def createProcessInstance(self):
+    def createProcessInstance(self, definition_name):
         return None
 
     #


=== Packages3/workflow/globalimportexport.py 1.5 => 1.6 ===
--- Packages3/workflow/globalimportexport.py:1.5	Mon Apr  7 13:33:49 2003
+++ Packages3/workflow/globalimportexport.py	Wed Apr  9 14:35:30 2003
@@ -23,6 +23,8 @@
 from zope.app.interfaces.workflow import IProcessDefinition
 from zope.app.interfaces.workflow import IGlobalProcessDefinitionImportExport
 
+from StringIO import StringIO
+
 class ImportExportUtility:
 
     __implements__ = IGlobalProcessDefinitionImportExport
@@ -39,11 +41,17 @@
     def importProcessDefinition(self, context, data):
         """Import a Process Definition
         """
+        if not hasattr(data, "read"):
+            data = StringIO(data)
+
         for iface, factory in self._importers.getRegisteredMatching():
             if iface.extends(IProcessDefinition):
                 imp = factory()
-                if imp.canImport(data):
+                data.seek(0)
+                if imp.canImport(context, data):
+                    data.seek(0)
                     return imp.doImport(context, data)
+
         raise ValueError, 'No Importer can handle that information'
 
     def exportProcessDefinition(self, context, process_definition):


=== Packages3/workflow/service.py 1.7 => 1.8 ===
--- Packages3/workflow/service.py:1.7	Sat Mar 22 13:17:34 2003
+++ Packages3/workflow/service.py	Wed Apr  9 14:35:30 2003
@@ -96,7 +96,7 @@
 
     def createProcessInstance(self, definition_name):
         pd = self.getProcessDefinition(definition_name)
-        return pd.createProcessInstance()
+        return pd.createProcessInstance(definition_name)
 
     createProcessInstance = ContextMethod(createProcessInstance)