Commit 5d55201a authored by Jérome Perrin's avatar Jérome Perrin

Workflow: don't change REQUEST when passing transition

The new workflow implementation from df85ef46 (ERP5Workflow: DC Workflows
are now ERP5 objects (!1378)., 2020-11-18) had a different behavior in
the implementation of _executeTransition, it was setting all kwargs
from the transition in REQUEST. The reasons for this are unclear, it
seem to come from the first Workflow implementation, 81784db4 (Initial
Import of ERP5Workflow porduct., 2010-10-15)

The side effects are that calling a workflow method, for example:

  document.edit(key=value)

would also alter the global request to set key=value in REQUEST, for the
rest of the current request.

It was causing subtle issues, especially in tests where the REQUEST
lifetime is long.
parent 713e90e2
Pipeline #19289 failed with stage
in 0 seconds
...@@ -834,7 +834,6 @@ class Workflow(XMLObject): ...@@ -834,7 +834,6 @@ class Workflow(XMLObject):
if object_context is None: if object_context is None:
# XXX(WORKFLOW): investigate: should I keep source value here, or can I use old_state (see test results also) # XXX(WORKFLOW): investigate: should I keep source value here, or can I use old_state (see test results also)
object_context = self.getStateChangeInformation(ob, self.getSourceValue()) object_context = self.getStateChangeInformation(ob, self.getSourceValue())
object_context.REQUEST.other.update(kwargs)
for vdef in self.getVariableValueList(): for vdef in self.getVariableValueList():
variable_id = vdef.getId() variable_id = vdef.getId()
......
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