Commit 3b1ce39c authored by Nicolas Delaby's avatar Nicolas Delaby

kw parameter can contain Objects which can not be pickeld. avoid to give them in activity.

Add a test for this expected behaviour


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24192 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f1952915
......@@ -311,15 +311,15 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
for script_name in tdef.activate_script_name:
self.activate(activity='SQLQueue')\
.activeScript(script_name, ob.getRelativeUrl(),
status, tdef.id, kw)
status, tdef.id)
security.declarePrivate('activeScript')
def activeScript(self, script_name, ob_url, status, tdef_id, kwargs=None):
def activeScript(self, script_name, ob_url, status, tdef_id):
script = self.scripts[script_name]
ob = self.unrestrictedTraverse(ob_url)
tdef = self.interactions.get(tdef_id)
sci = StateChangeInfo(
ob, self, status, tdef, None, None, kwargs)
ob, self, status, tdef, None, None, None)
script(sci)
def _getWorkflowStateOf(self, ob, id_only=0):
......
......@@ -527,6 +527,33 @@ context.setDescription('%s,%s,%s' % (d, args, result))
get_transaction().commit()
self.assertEquals(organisation.getDescription(), "toto,('description',),bad")
def test_17_activity_interaction(self, quiet=0, run=run_all_test):
if not run: return
if not quiet:
self.logMessage('Later Script (In activity)')
self.createInteractionWorkflow()
self.interaction.setProperties(
'editObject',
once_per_transaction=1,
method_id='_setGroup.*',
activate_script_name=('afterEdit',))
params = 'sci, **kw'
body = """\
context = sci['object']
context.setTitle('Bar')
"""
self.script.ZPythonScript_edit(params, body)
self.createData()
organisation = self.organisation
organisation.setTitle('Foo')
organisation.setGroupValue(organisation)
self.assertEquals(organisation.getTitle(), 'Foo')
get_transaction().commit()
self.assertEquals(organisation.getTitle(), 'Foo')
self.tic()
self.assertEquals(organisation.getTitle(), 'Bar')
def test_regular_expression(self):
# test that we can add an interaction by defining methods using regular
# expression
......
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