[CMF-checkins] CVS: CMF/CMFSetup - workflow.py:1.6
Tres Seaver
tseaver at zope.com
Fri Jun 4 23:17:21 EDT 2004
Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv32305
Modified Files:
workflow.py
Log Message:
- tests/common.py:
o Harden DOMComparator against spurious whitespace diffs.
- workflow.py:
o Implement / test export of workflow definition.
o Note that this required changing semantics of some dump info
in order better to fit the "normalized" XML we are aiming for.
=== CMF/CMFSetup/workflow.py 1.5 => 1.6 ===
--- CMF/CMFSetup/workflow.py:1.5 Thu Jun 3 19:11:34 2004
+++ CMF/CMFSetup/workflow.py Fri Jun 4 23:16:47 2004
@@ -148,13 +148,6 @@
return workflow_info
- security.declareProtected( ManagePortal, 'generateToolXML' )
- def generateToolXML( self ):
-
- """ Pseudo API.
- """
- return self._toolConfig()
-
security.declareProtected( ManagePortal, 'listWorkflowInfo' )
def listWorkflowInfo( self ):
@@ -189,6 +182,20 @@
return result
+ security.declareProtected( ManagePortal, 'generateToolXML' )
+ def generateToolXML( self ):
+
+ """ Pseudo API.
+ """
+ return self._toolConfig()
+
+ security.declareProtected( ManagePortal, 'generateWorkflowXML' )
+ def generateWorkflowXML( self, workflow_id ):
+
+ """ Pseudo API.
+ """
+ return self._workflowConfig( workflow_id=workflow_id )
+
#
# Helper methods
#
@@ -198,6 +205,12 @@
, __name__='toolConfig'
)
+ security.declarePrivate( '_workflowConfig' )
+ _workflowConfig = PageTemplateFile( 'wtcWorkflowExport.xml'
+ , _xmldir
+ , __name__='workflowConfig'
+ )
+
security.declarePrivate( '_extractDCWorkflowInfo' )
def _extractDCWorkflowInfo( self, workflow, workflow_info ):
@@ -290,9 +303,9 @@
, 'update_always' : bool( v.update_always )
, 'default_value' : v.default_value
, 'default_expr' : v.getDefaultExprText()
- , 'guard_permissions' : guard.getPermissionsText()
- , 'guard_roles' : guard.getRolesText()
- , 'guard_groups' : guard.getGroupsText()
+ , 'guard_permissions' : guard.permissions
+ , 'guard_roles' : guard.roles
+ , 'guard_groups' : guard.groups
, 'guard_expr' : guard.getExprText()
}
@@ -337,11 +350,20 @@
for k, v in workflow.states.objectItems():
+ groups = v.group_roles and list( v.group_roles.items() ) or []
+ groups = [ x for x in groups if x[1] ]
+ groups.sort()
+
+ variables = list( v.getVariableValues() )
+ variables.sort()
+
info = { 'id' : k
, 'title' : v.title
, 'description' : v.description
, 'transitions' : v.transitions
, 'permissions' : self._extractStatePermissions( v )
+ , 'groups' : groups
+ , 'variables' : variables
}
result.append( info )
@@ -444,9 +466,9 @@
, 'actbox_url' : v.actbox_url
, 'actbox_category' : v.actbox_category
, 'variables' : v.getVariableExprs()
- , 'guard_permissions' : guard.getPermissionsText()
- , 'guard_roles' : guard.getRolesText()
- , 'guard_groups' : guard.getGroupsText()
+ , 'guard_permissions' : guard.permissions
+ , 'guard_roles' : guard.roles
+ , 'guard_groups' : guard.groups
, 'guard_expr' : guard.getExprText()
}
@@ -504,9 +526,9 @@
, 'actbox_name' : v.actbox_name
, 'actbox_url' : v.actbox_url
, 'actbox_category' : v.actbox_category
- , 'guard_permissions' : guard.getPermissionsText()
- , 'guard_roles' : guard.getRolesText()
- , 'guard_groups' : guard.getGroupsText()
+ , 'guard_permissions' : guard.permissions
+ , 'guard_roles' : guard.roles
+ , 'guard_groups' : guard.groups
, 'guard_expr' : guard.getExprText()
}
More information about the CMF-checkins
mailing list