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

Workflow: Avoid lstrip in isERP5WorkflowMethodSupported.

parent 7cdf2dec
......@@ -141,24 +141,13 @@ class Workflow(XMLObject):
state=state)
def isERP5WorkflowMethodSupported(self, document, transition):
sdef = self._getERP5WorkflowStateOf(document)
sdef = document._getDefaultAcquiredValue(self.getStateBaseCategory())
if sdef is None:
return 0
if transition in sdef.getDestinationValueList():
return 1
return 0
def _getERP5WorkflowStateOf(self, ob):
bc_id = self.getStateBaseCategory()
state_path = ob.getCategoryList()
### should avoid using lstrip
state_path = state_path[0].lstrip("%s/"%bc_id)
if state_path is not None:
sdef = self.restrictedTraverse(state_path)
else: sdef = None
return sdef
###########
## Graph ##
############
......
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