Commit 4129833b authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: getWorkflowsFor directly using ob to get workflow assignements.

parent c9dadf2a
...@@ -199,8 +199,8 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -199,8 +199,8 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
if isinstance(ob, basestring): if isinstance(ob, basestring):
portal_type = self.getPortalObject().portal_types._getOb(ob, None) portal_type = self.getPortalObject().portal_types._getOb(ob, None)
elif hasattr(aq_base(ob), 'getPortalType'): elif hasattr(aq_base(ob), 'getTypeInfo'):
portal_type = self.getPortalObject().portal_types._getOb(ob.getPortalType(), None) portal_type = ob.getTypeInfo()
else: else:
portal_type = None portal_type = None
...@@ -567,7 +567,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -567,7 +567,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
def isTransitionPossible(self, ob, transition_id, wf_id=None): def isTransitionPossible(self, ob, transition_id, wf_id=None):
"""Test if the given transition exist from the current state. """Test if the given transition exist from the current state.
""" """
for workflow in (wf_id and (self[wf_id],) or self.getWorkflowsFor(ob.getPortalType())): for workflow in (wf_id and (self[wf_id],) or self.getWorkflowsFor(ob)):
state = workflow._getWorkflowStateOf(ob) state = workflow._getWorkflowStateOf(ob)
if state and transition_id in state.getDestinationReferenceList(): if state and transition_id in state.getDestinationReferenceList():
return 1 return 1
...@@ -905,7 +905,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool): ...@@ -905,7 +905,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
trash_tool = getattr(self.getPortalObject(), 'portal_trash', None) trash_tool = getattr(self.getPortalObject(), 'portal_trash', None)
if trash_tool is not None: if trash_tool is not None:
# move old workflow to trash tool; # move old workflow to trash tool;
LOG('WorkflowTool', WARNING, "Move old workflow '%s' into a trash bin."%dc_wf.id) LOG(" | Move old workflow '%s' into a trash bin"%dc_wf.id, 0, " in WorkflowTool.py 908.")
self._delOb(dc_wf.id) self._delOb(dc_wf.id)
trashbin = UnrestrictedMethod(trash_tool.newTrashBin)(dc_wf.id) trashbin = UnrestrictedMethod(trash_tool.newTrashBin)(dc_wf.id)
trashbin._setOb(dc_wf.id, dc_wf) trashbin._setOb(dc_wf.id, dc_wf)
......
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