Commit 4853cc2c authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make an acquisition wrapper for StateChangeInfo when executing a script, so...

Make an acquisition wrapper for StateChangeInfo when executing a script, so that proxy roles work in the context of a workflow.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6430 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1ca86a74
......@@ -27,6 +27,14 @@ from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Utils import convertToMixedCase
from string import join
from zLOG import LOG
from Acquisition import Explicit
class ERP5StateChangeInfo(Explicit, StateChangeInfo):
"""Override StateChangeInfo to make an acquisition wrapper, so that
zope can obtain the context. This is important to make proxy roles effective
in workflow scripts.
"""
pass
def DCWorkflowDefinition_listGlobalActions(self, info):
'''
......@@ -148,8 +156,9 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
if tdef is not None and tdef.script_name:
script = self.scripts[tdef.script_name]
# Pass lots of info to the script in a single parameter.
sci = StateChangeInfo(
sci = ERP5StateChangeInfo(
ob, self, former_status, tdef, old_sdef, new_sdef, kwargs)
sci = sci.__of__(self)
try:
#LOG('_executeTransition', 0, "script = %s, sci = %s" % (repr(script), repr(sci)))
script(sci) # May throw an exception.
......@@ -229,8 +238,9 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
else:
script = self.scripts[tdef.after_script_name]
# Pass lots of info to the script in a single parameter.
sci = StateChangeInfo(
sci = ERP5StateChangeInfo(
ob, self, status, tdef, old_sdef, new_sdef, kwargs)
sci = sci.__of__(self)
script(sci) # May throw an exception.
# Return the new state object.
......
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