Commit 6f7223dd authored by iv's avatar iv

ERP5Workflow: use get...List methods

parent b97ae55e
......@@ -306,7 +306,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
_(u'Requested workflow not found.'))
tdef = self._getOb(id=action)
if tdef not in self.objectValues(portal_type='Transition'):
if tdef not in self.getTransitionValueList():
raise Unauthorized(action)
if tdef is None or tdef.getTriggerType() != TRIGGER_USER_ACTION:
msg = _(u"Transition '${action_id}' is not triggered by a user "
......@@ -378,7 +378,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
(worklist id as key) and which value is a dict composed of
variable matches.
"""
if not self.objectValues(portal_type='Worklist'):
if not self.getWorklistValueList():
return None
portal = self.getPortalObject()
......@@ -549,7 +549,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
return 'transition_' + transition_reference
def getScriptIdByReference(self, script_reference):
return 'script_' + script_reference
return SCRIPT_PREFIX + script_reference
def getWorklistValueById(self, worklist_reference):
return self._getOb('worklist_' + worklist_reference, None)
......@@ -858,7 +858,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 1. State as XML
state_reference_list = []
state_list = self.objectValues(portal_type='State')
state_list = self.getStateValueList()
# show reference instead of id
state_prop_id_to_show = ['description',
'transitions', 'permission_roles']
......@@ -890,12 +890,12 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 2. Transition as XML
transition_reference_list = []
transition_list = self.objectValues(portal_type='Transition')
transition_list = self.getTransitionValueList()
transition_prop_id_to_show = ['description', 'new_state_id',
'trigger_type', 'script_name', 'after_script_name', 'action_type',
'icon', 'action_name', 'action', 'roles', 'groups',
'permissions', 'expr', 'transition_variable']
for tdef in self.objectValues(portal_type='Transition'):
for tdef in transition_list:
transition_reference_list.append(tdef.getReference())
transitions = SubElement(workflow, 'transitions',
attrib=dict(transition_list=str(transition_reference_list),
......@@ -991,7 +991,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 4. Worklist as XML
worklist_reference_list = []
worklist_list = self.objectValues(portal_type='Worklist')
worklist_list = self.getWorklistValueList()
worklist_prop_id_to_show = ['description', 'matched_portal_type_list',
'matched_validation_state_list', 'matched_simulation_state_list',
'action_type', 'action_name', 'action', 'icon',
......@@ -1038,7 +1038,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 5. Script as XML
script_reference_list = []
script_list = self.objectValues(portal_type='Workflow Script')
script_list = self.getScriptValueList()
script_prop_id_to_show = sorted(['body', 'parameter_signature','proxy_roles'])
for sdef in script_list:
script_reference_list.append(sdef.getReference())
......@@ -1195,7 +1195,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self.workflow_managed_permission = permission_list
# add/remove the added/removed workflow permission to each state
for state in self.objectValues(portal_type='State'):
for state in self.getStateValueList():
state.setCellRange(sorted(permission_list),
sorted(self.getManagedRoleList()),
base_id='cell')
......
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