[CMF-checkins] CVS: CMF/CMFSetup - workflow.py:1.14
Tres Seaver
tseaver at zope.com
Wed Jun 16 00:28:58 EDT 2004
Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv14214
Modified Files:
workflow.py
Log Message:
- workflow.xml:
o Implement top-level export and test.
o Fix 'generateWorkflowXML' when multiple workflows are present.
o Ensure that non-DCWorkflows don't result in XML files.
=== CMF/CMFSetup/workflow.py 1.13 => 1.14 ===
--- CMF/CMFSetup/workflow.py:1.13 Tue Jun 8 22:43:25 2004
+++ CMF/CMFSetup/workflow.py Wed Jun 16 00:28:23 2004
@@ -100,11 +100,20 @@
"""
site = context.getSite()
- apc = WorkflowToolConfigurator( site ).__of__( site )
- text = apc.generateXML()
+ configurator = WorkflowToolConfigurator( site ).__of__( site )
+ wf_tool = getToolByName( site, 'portal_workflow' )
+ text = configurator.generateToolXML()
context.writeDataFile( _FILENAME, text, 'text/xml' )
+ for wf_id in wf_tool.getWorkflowIds():
+
+ wf_filename = _getWorkflowFilename( wf_id )
+ wf_xml = configurator.generateWorkflowXML( wf_id )
+
+ if wf_xml is not None:
+ context.writeDataFile( wf_filename, wf_xml, 'text/xml' )
+
return 'Workflows exported.'
@@ -199,6 +208,11 @@
""" Pseudo API.
"""
+ info = self.getWorkflowInfo( workflow_id )
+
+ if info[ 'meta_type' ] != DCWorkflowDefinition.meta_type:
+ return None
+
return self._workflowConfig( workflow_id=workflow_id )
security.declareProtected( ManagePortal, 'parseToolXML' )
@@ -294,8 +308,7 @@
'script_info' -- a list of mappings describing the scripts which
provide added business logic (wee '_extractScripts').
"""
- workflow_info[ 'filename' ] = ( 'workflows/%s/definition.xml'
- % workflow.getId())
+ workflow_info[ 'filename' ] = _getWorkflowFilename( workflow.getId() )
workflow_info[ 'state_variable' ] = workflow.state_var
workflow_info[ 'initial_state' ] = workflow.initial_state
workflow_info[ 'permissions' ] = workflow.permissions
@@ -947,3 +960,9 @@
, ExternalMethod.meta_type : 'em'
, DTMLMethod.meta_type : 'dtml'
}
+
+def _getWorkflowFilename( wf_id ):
+
+ """ Return the name of the file which holds info for a given workflow.
+ """
+ return 'workflows/%s/definition.xml' % wf_id.replace( ' ', '_' )
More information about the CMF-checkins
mailing list