Commit 74249cd5 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

WorkflowTool.py: resolve the error when state has no premission_roles, matrix...

WorkflowTool.py: resolve the error when state has no premission_roles, matrix index should not be generated.
parent ba9c8374
...@@ -352,18 +352,19 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -352,18 +352,19 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
state.setDescription(sdef.description) state.setDescription(sdef.description)
permission_roles = sdef.permission_roles permission_roles = sdef.permission_roles
state.setStatePermissionRoles(permission_roles) state.setStatePermissionRoles(permission_roles)
state.setCellRange(sorted(sdef.permission_roles.keys()), if sdef.permission_roles is not None:
sorted(workflow.getRoleList()), state.setCellRange(sorted(sdef.permission_roles.keys()),
base_id='cell') sorted(workflow.getRoleList()),
i = -1 base_id='cell')
for permission in sorted(workflow.getWorkflowManagedPermissionList()): i = -1
i = i + 1 for permission in sorted(workflow.getWorkflowManagedPermissionList()):
j = -1 i = i + 1
for role in workflow.getRoleList(): j = -1
j = j + 1 for role in workflow.getRoleList():
pr_cell = state.newContent(id='cell_%s_%s'%(i,j), portal_type='PermissionRoles') j = j + 1
if permission in permission_roles and role in permission_roles[permission]: pr_cell = state.newContent(id='cell_%s_%s'%(i,j), portal_type='PermissionRoles')
pr_cell.is_selected = 1 if permission in permission_roles and role in permission_roles[permission]:
pr_cell.is_selected = 1
# Set Workflow default state using category setter # Set Workflow default state using category setter
state_path = getattr(workflow, 'state_'+dc_workflow.initial_state).getPath() state_path = getattr(workflow, 'state_'+dc_workflow.initial_state).getPath()
state_path = 'source/' + '/'.join(state_path.split('/')[2:]) state_path = 'source/' + '/'.join(state_path.split('/')[2:])
......
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