[CMF-checkins] CVS: CMF/CMFSetup - workflow.py:1.4

Tres Seaver tseaver at zope.com
Thu Jun 3 18:02:33 EDT 2004


Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv22568

Modified Files:
	workflow.py 
Log Message:


  - workflow.py:

    o Implement script extraction.

  - xml/*.xml:

    o Split / rename workflow export templates (tool export separate from
      individual DCWorkflow export).


=== CMF/CMFSetup/workflow.py 1.3 => 1.4 ===
--- CMF/CMFSetup/workflow.py:1.3	Thu Jun  3 15:26:08 2004
+++ CMF/CMFSetup/workflow.py	Thu Jun  3 18:02:01 2004
@@ -193,7 +193,12 @@
 
           'worklist_info' -- a list of mappings describing the
             worklists tracked by the workflow (see '_extractWorklists').
+
+          '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[ 'state_variable' ] = workflow.state_var
         workflow_info[ 'initial_state' ] = workflow.initial_state
         workflow_info[ 'permissions' ] = workflow.permissions
@@ -202,6 +207,7 @@
         workflow_info[ 'transition_info' ] = self._extractTransitions(
                                                                    workflow )
         workflow_info[ 'worklist_info' ] = self._extractWorklists( workflow )
+        workflow_info[ 'script_info' ] = self._extractScripts( workflow )
 
     security.declarePrivate( '_extractVariables' )
     def _extractVariables( self, workflow ):
@@ -466,6 +472,33 @@
                    , 'guard_roles'          : guard.getRolesText()
                    , 'guard_groups'         : guard.getGroupsText()
                    , 'guard_expr'           : guard.getExprText()
+                   }
+
+            result.append( info )
+
+        return result
+
+    security.declarePrivate( '_extractScripts' )
+    def _extractScripts( self, workflow ):
+
+        """ Return a sequence of mappings describing DCWorkflow scripts.
+
+        o Each mapping has the keys:
+
+          'id' -- the ID of the script
+
+          'meta_type' -- the title of the worklist
+
+          'body' -- the text of the script
+
+        """
+        result = []
+
+        for k, v in workflow.scripts.objectItems():
+
+            info = { 'id'                   : k
+                   , 'meta_type'            : v.meta_type
+                   , 'body'                 : v.read()
                    }
 
             result.append( info )




More information about the CMF-checkins mailing list