[Zope3-checkins] CVS: Packages3/workflow/stateful - definition.py:1.7 xmlimportexport.py:1.5

Michael Howitz mh+zope@gocept.com
Thu, 27 Mar 2003 11:26:14 -0500


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

Modified Files:
	definition.py xmlimportexport.py 
Log Message:
import and export of stateful workflow now works


=== Packages3/workflow/stateful/definition.py 1.6 => 1.7 ===
--- Packages3/workflow/stateful/definition.py:1.6	Wed Mar 26 13:27:42 2003
+++ Packages3/workflow/stateful/definition.py	Thu Mar 27 11:26:13 2003
@@ -138,6 +138,7 @@
         self.__transitions = TransitionsContainer()
         self.__schema = None
 
+    _clear = clear = __init__
 
     ############################################################
     # Implementation methods for interface


=== Packages3/workflow/stateful/xmlimportexport.py 1.4 => 1.5 ===
--- Packages3/workflow/stateful/xmlimportexport.py:1.4	Thu Mar 27 09:00:51 2003
+++ Packages3/workflow/stateful/xmlimportexport.py	Thu Mar 27 11:26:13 2003
@@ -65,9 +65,12 @@
     def startState(self, attrs):
         title = attrs.get('title', '').encode('latin-1')
         name  = attrs['name'].encode('latin-1')
-        state = State()
-        getAdapter(state, IZopeDublinCore).setQualifiedTitles([('',title)])
-        if name != 'INITIAL':
+        if name == 'INITIAL':
+            state = self.context.getState('INITIAL')
+            getAdapter(state, IZopeDublinCore).setQualifiedTitles([('',title)])
+        else:
+            state = State()
+            getAdapter(state, IZopeDublinCore).setQualifiedTitles([('',title)])
             self.context.addState(name, state)
 
     def startTransition(self, attrs):
@@ -97,6 +100,7 @@
         return True
 
     def doImport(self, context, data):
+        context.clear()
         if not hasattr(data, "read"):
             data = StringIO(data)
         parse(data, XMLStatefulImporter(context))