[Zope3-checkins] CVS: Packages3/workflow/stateful - xmlexport_template.pt:1.2 xmlimportexport.py:1.2
Michael Howitz
mh+zope@gocept.com
Thu, 27 Mar 2003 05:55:59 -0500
Update of /cvs-repository/Packages3/workflow/stateful
In directory cvs.zope.org:/tmp/cvs-serv23575/stateful
Modified Files:
xmlexport_template.pt xmlimportexport.py
Log Message:
xml-export of workflow-definition-data now works
=== Packages3/workflow/stateful/xmlexport_template.pt 1.1 => 1.2 ===
--- Packages3/workflow/stateful/xmlexport_template.pt:1.1 Wed Mar 26 12:43:38 2003
+++ Packages3/workflow/stateful/xmlexport_template.pt Thu Mar 27 05:55:58 2003
@@ -1,5 +1,27 @@
-<workflows>
- <processdefinition>
- some information
- </processdefinition>
-</workflows>
\ No newline at end of file
+<?xml version="1.0"?>
+<workflow type="Zope3Workflow"
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ tal:define="wf view/getDefinition"
+ tal:attributes="title python:view.getDublinCore(wf).Title()">
+ <schema tal:attributes="name wf/getRelevantDataSchema"></schema>
+ <states>
+ <state
+ tal:repeat="state wf/getStateNames"
+ tal:attributes="title python:view.getDublinCore(wf.getState(state)).Title();
+ name state"></state>
+ </states>
+ <transitions>
+ <tal:block tal:repeat="trans wf/getTransitionNames">
+ <transition
+ tal:define="transObj python:wf.getTransition(trans)"
+ tal:attributes="sourceState transObj/getSourceState;
+ destinationState transObj/getDestinationState;
+ condition transObj/getCondition;
+ permission transObj/getPermission;
+ triggerMode transObj/getTriggerMode;
+ title python:view.getDublinCore(transObj).Title();
+ name trans"></transition>
+ </tal:block>
+ </transitions>
+
+</workflow>
\ No newline at end of file
=== Packages3/workflow/stateful/xmlimportexport.py 1.1 => 1.2 ===
--- Packages3/workflow/stateful/xmlimportexport.py:1.1 Wed Mar 26 12:43:38 2003
+++ Packages3/workflow/stateful/xmlimportexport.py Thu Mar 27 05:55:58 2003
@@ -21,6 +21,10 @@
import ViewPageTemplateFile
from zope.app.interfaces.workflow import IProcessDefinitionImportHandler
from zope.app.interfaces.workflow import IProcessDefinitionExportHandler
+from zope.component import getAdapter, getServiceManager
+from zope.app.interfaces.dublincore import IZopeDublinCore
+from types import StringTypes
+from zope.proxy.context import ContextMethod
class XMLImportHandler:
@@ -39,10 +43,25 @@
template = ViewPageTemplateFile('xmlexport_template.pt')
- def doExport(self, process_definition):
+ def doExport(self, context, process_definition):
# XXX Not really nice to fake a BrowserView here ....
self.request = None
- self.context = process_definition
+ self.process_definition = process_definition
+ self.context = context
return self.template()
+ def getDefinition(self):
+ return self.process_definition
+
+ def getDublinCore(self, obj):
+ return getAdapter(obj, IZopeDublinCore)
+
+# not working, schema-class should be in an filesystem based module
+# which gets imported separately
+## def getSchemaClass(self):
+## schema = self.process_definition.getRelevantDataSchema()
+## if type(schema) in StringTypes:
+## sm = getServiceManager(self.context)
+## schema = sm.resolve(schema)
+## return schema