[CMF-checkins] CVS: CMF - WorkflowTool.py:1.16

Jens Vagelpohl jens@digicool.com
Thu, 14 Jun 2001 17:22:02 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/tmp/cvs-serv1125/CMFCore

Modified Files:
	WorkflowTool.py 
Log Message:
improved scriptability of the workflow tool:

new method "setDefaultChain" lets you set the default workflow chain much easier than 
"manage_changeWorkflows"





--- Updated File WorkflowTool.py in package CMF --
--- WorkflowTool.py	2001/06/13 21:44:08	1.15
+++ WorkflowTool.py	2001/06/14 21:22:02	1.16
@@ -263,6 +263,20 @@
             return self.manage_selectWorkflows(REQUEST, manage_tabs_message=
                                                'Changed.')
 
+    security.declareProtected( CMFCorePermissions.ManagePortal
+                             , 'setDefaultChain')
+    def setDefaultChain(self, default_chain):
+        """ Set the default chain """
+        default_chain = replace(default_chain, ',', ' ')
+        ids = []
+        for wf_id in split(default_chain, ' '):
+            if wf_id:
+                if not self.getWorkflowById(wf_id):
+                    raise ValueError, ( '"%s" is not a workflow ID.' % wf_id)
+                ids.append(wf_id)
+
+        self._default_chain = tuple(ids)
+
     security.declareProtected(CMFCorePermissions.ManagePortal,
                               'setChainForPortalTypes')
     def setChainForPortalTypes(self, pt_names, chain):
@@ -279,7 +293,7 @@
             id = t.getId()
             if id in pt_names:
                 cbt[id] = tuple(chain)
-                
+
 
     security.declareProtected(CMFCorePermissions.ManagePortal,
                               'updateRoleMappings')