Commit 75b6cdbc authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: when add workflow_id from type_workflow_list to...

WorkflowTool.py: when add workflow_id from type_workflow_list to _chain_by_type, first check if portal_type is already in chain_by_type. If it is already there, then move the workflow_id, else, create the dict and add the workflow_id.
parent f40882c3
...@@ -202,8 +202,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -202,8 +202,11 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
portal_type = self.getPortalObject().portal_types._getOb(portal_type_id, None) portal_type = self.getPortalObject().portal_types._getOb(portal_type_id, None)
if portal_type is not None: if portal_type is not None:
for workflow_id in portal_type.getTypeWorkflowList(): for workflow_id in portal_type.getTypeWorkflowList():
if portal_type_id in self._chains_by_type:
if workflow_id not in self._chains_by_type[portal_type_id]: if workflow_id not in self._chains_by_type[portal_type_id]:
self.addTypeCBT(portal_type_id, workflow_id) self.addTypeCBT(portal_type_id, workflow_id)
else:
self._chains_by_type[portal_type_id] = (workflow_id,)
def getChainFor(self, ob): def getChainFor(self, ob):
""" Get the chain that applies to the given object. """ Get the chain that applies to the given object.
......
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