Commit ee72e601 authored by iv's avatar iv

ERP5Workflow: raise if script_id is not correct

parent fb5b832a
...@@ -586,6 +586,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -586,6 +586,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if tdef is None: if tdef is None:
new_sdef = self.getSourceValue() new_sdef = self.getSourceValue()
new_state = new_sdef.getReference() new_state = new_sdef.getReference()
if not new_sdef: if not new_sdef:
# Do nothing if there is no initial state. We may want to create # Do nothing if there is no initial state. We may want to create
# workflows with no state at all, only for worklists. # workflows with no state at all, only for worklists.
...@@ -607,8 +608,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -607,8 +608,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
sci = StateChangeInfo( sci = StateChangeInfo(
document, self, former_status, tdef, old_sdef, new_sdef, kwargs) document, self, former_status, tdef, old_sdef, new_sdef, kwargs)
for script_id in script_id_list: for script_id in script_id_list:
script = self._getOb(script_id, None) script = self._getOb(script_id)
if script:
# Pass lots of info to the script in a single parameter. # Pass lots of info to the script in a single parameter.
if script.getPortalType() != 'Workflow Script': if script.getPortalType() != 'Workflow Script':
raise NotImplementedError ('Unsupported Script %s for state %s'%(script_id, old_sdef.getReference())) raise NotImplementedError ('Unsupported Script %s for state %s'%(script_id, old_sdef.getReference()))
...@@ -696,14 +696,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -696,14 +696,14 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
self.updateRoleMappingsFor(document) self.updateRoleMappingsFor(document)
# Execute the "after" script. # Execute the "after" script.
if tdef is not None and tdef.getAfterScriptIdList(): if tdef is not None:
script_id_list = tdef.getAfterScriptIdList() script_id_list = tdef.getAfterScriptIdList()
if script_id_list:
kwargs = form_kw kwargs = form_kw
sci = StateChangeInfo( sci = StateChangeInfo(
document, self, former_status, tdef, old_sdef, new_sdef, kwargs) document, self, former_status, tdef, old_sdef, new_sdef, kwargs)
for script_id in script_id_list: for script_id in script_id_list:
script = self._getOb(script_id, None) script = self._getOb(script_id)
if script:
# Script can be either script or workflow method # Script can be either script or workflow method
if script_id in old_sdef.getDestinationIdList() and \ if script_id in old_sdef.getDestinationIdList() and \
self._getOb(script_id).getTriggerType() == TRIGGER_WORKFLOW_METHOD: self._getOb(script_id).getTriggerType() == TRIGGER_WORKFLOW_METHOD:
......
  • Please use getAfterScriptValueList and getBeforeScriptValueList

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