Commit b108df4b authored by Jérome Perrin's avatar Jérome Perrin

remove useless call to updateState

do not catch ObjectMoved


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4034 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 506c2d65
...@@ -188,7 +188,6 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -188,7 +188,6 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
a notifySuccess() or notifyException() can be expected later on. a notifySuccess() or notifyException() can be expected later on.
The action usually corresponds to a method name. The action usually corresponds to a method name.
''' '''
# LOG('InteractionWorflow.notifyBefore, ob',0,ob)
for t in self.interactions.values(): for t in self.interactions.values():
tdef = None tdef = None
if t.trigger_type == TRIGGER_AUTOMATIC: if t.trigger_type == TRIGGER_AUTOMATIC:
...@@ -210,11 +209,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -210,11 +209,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
# Pass lots of info to the script in a single parameter. # Pass lots of info to the script in a single parameter.
sci = StateChangeInfo( sci = StateChangeInfo(
ob, self, former_status, tdef, None, None, kwargs=kw) ob, self, former_status, tdef, None, None, kwargs=kw)
try: script(sci) # May throw an exception.
script(sci) # May throw an exception.
except ObjectMoved, moved_exc:
ob = moved_exc.getNewObject()
# Re-raise after transition
security.declarePrivate('notifySuccess') security.declarePrivate('notifySuccess')
def notifySuccess(self, ob, action, result, args=None, kw=None): def notifySuccess(self, ob, action, result, args=None, kw=None):
...@@ -236,7 +231,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -236,7 +231,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
if t.portal_type_filter is None: if t.portal_type_filter is None:
tdef = t tdef = t
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
tdef = t tdef = t
if tdef is not None: if tdef is not None:
# Update variables. # Update variables.
former_status = self._getStatusOf(ob) former_status = self._getStatusOf(ob)
...@@ -269,25 +264,19 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -269,25 +264,19 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
value = expr(econtext) value = expr(econtext)
status[id] = value status[id] = value
# Update state. # Execute "after" scripts
tool = aq_parent(aq_inner(self))
tool.setStatusOf(self.id, ob, status)
# Execute the "after" script.
for script_name in tdef.after_script_name: for script_name in tdef.after_script_name:
script = self.scripts[script_name] script = self.scripts[script_name]
# Pass lots of info to the script in a single parameter. # Pass lots of info to the script in a single parameter.
sci = StateChangeInfo( sci = StateChangeInfo(
ob, self, status, tdef, None, None, kwargs=kw) ob, self, status, tdef, None, None, kwargs=kw)
try: script(sci) # May throw an exception.
script(sci) # May throw an exception.
except ObjectMoved, moved_exc:
ob = moved_exc.getNewObject()
# Re-raise after transition
# Execute the "after" script. # Execute "activity" scripts
for script_name in tdef.activate_script_name: for script_name in tdef.activate_script_name:
self.activate(activity='SQLQueue').activeScript(script_name, ob.getRelativeUrl(), status, tdef.id) self.activate(activity='SQLQueue')\
.activeScript(script_name, ob.getRelativeUrl(), status, tdef.id)
security.declarePrivate('activeScript') security.declarePrivate('activeScript')
def activeScript(self, script_name, ob_url, status, tdef_id): def activeScript(self, script_name, ob_url, status, tdef_id):
...@@ -295,8 +284,8 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -295,8 +284,8 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
ob = self.restrictedTraverse(ob_url) ob = self.restrictedTraverse(ob_url)
tdef = self.interactions.get(tdef_id) tdef = self.interactions.get(tdef_id)
sci = StateChangeInfo( sci = StateChangeInfo(
ob, self, status, tdef, None, None, None) ob, self, status, tdef, None, None, None)
script(sci) script(sci)
def _getWorkflowStateOf(self, ob, id_only=0): def _getWorkflowStateOf(self, ob, id_only=0):
return None return None
......
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