Commit cf1d0aa8 authored by Kevin Deldycke's avatar Kevin Deldycke

Generate methods that support the translation of workflow states


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3966 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9b1b0411
...@@ -204,6 +204,22 @@ def initializePortalTypeDynamicProperties(self, klass, ptype): ...@@ -204,6 +204,22 @@ def initializePortalTypeDynamicProperties(self, klass, ptype):
prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id ) prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id )
#LOG('in aq_portal_type %s' % id, 0, "added state method %s" % method_id) #LOG('in aq_portal_type %s' % id, 0, "added state method %s" % method_id)
#LOG('in aq_portal_type %s' % id, 0, "found transition workflow %s" % wf.id) #LOG('in aq_portal_type %s' % id, 0, "found transition workflow %s" % wf.id)
# Generate methods that support the translation of workflow states
for wf in portal_workflow.getWorkflowsFor(self):
wf_id = wf.id
if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
# Create state var accessor
state_var = wf.variables.getStateVar()
method_id = 'getTranslated%s' % UpperCase(state_var)
if not hasattr(prop_holder, method_id):
method = WorkflowState.TranslatedGetter(method_id, wf_id)
setattr(prop_holder, method_id, method) # Attach to portal_type
prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id )
method_id = 'getTranslated%sTitle' % UpperCase(state_var)
if not hasattr(prop_holder, method_id):
method = WorkflowState.TranslatedTitleGetter(method_id, wf_id)
setattr(prop_holder, method_id, method) # Attach to portal_type
prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id )
if wf.__class__.__name__ in ('DCWorkflowDefinition', ): if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
for tr_id in wf.transitions.objectIds(): for tr_id in wf.transitions.objectIds():
tdef = wf.transitions.get(tr_id, None) tdef = wf.transitions.get(tr_id, None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment