Commit c17da2c1 authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: small improvement in getWorkflowValueListFor, remove no necessary attribute.

parent 8fef7223
...@@ -196,16 +196,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -196,16 +196,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
workflow_list = [] workflow_list = []
if isinstance(ob, basestring): if isinstance(ob, basestring):
portal_type_id = ob portal_type = self.getPortalObject().portal_types._getOb(ob, None)
elif hasattr(aq_base(ob), 'getPortalType'): elif hasattr(aq_base(ob), 'getPortalType'):
portal_type_id = ob.getPortalType() portal_type = self.getPortalObject().portal_types._getOb(ob.getPortalType(), None)
else: else:
portal_type_id = None portal_type = None
if portal_type_id is None:
return workflow_list
portal_type = self.getPortalObject().portal_types._getOb(portal_type_id, None)
# Workflow assignment: # Workflow assignment:
if portal_type is not None: if portal_type is not None:
...@@ -704,8 +699,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -704,8 +699,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
for wf_id in workflow_list: for wf_id in workflow_list:
did[wf_id] = None did[wf_id] = None
wf = self.getPortalObject().portal_workflow._getOb(wf_id, None) wf = self.getPortalObject().portal_workflow._getOb(wf_id, None)
if wf is None: if wf is not None:
raise NotImplementedError ("Can not find workflow: %s, please check if the workflow exists."%wf_id)
a = wf.listObjectActions(info) a = wf.listObjectActions(info)
if a is not None and a != []: if a is not None and a != []:
actions.extend(a) actions.extend(a)
......
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