Commit b405ca1c authored by Guillaume Michon's avatar Guillaume Michon

In activate(), get activate_kw, then _v_activate_kw values only if such values...

In activate(), get activate_kw, then _v_activate_kw values only if such values are not set directly as arguments to activate()


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5878 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 40f3ff87
...@@ -71,18 +71,24 @@ class ActiveObject(ExtensionClass.Base): ...@@ -71,18 +71,24 @@ class ActiveObject(ExtensionClass.Base):
going to be executed going to be executed
""" """
# Get activate values from activate_kw, then _v_activate_kw
# only if they are not set directly as arguments to activate()
if activate_kw is not None: if activate_kw is not None:
kw.update(activate_kw) for key,value in activate_kw.items():
if not kw.has_key(key):
kw[key] = value
# This volatile variable '_v_activate_kw' can be used to pass parameters
# automatically to activate.
if hasattr(self, '_v_activate_kw'):
for key,value in self._v_activate_kw.items():
if not kw.has_key(key):
kw[key] = value
activity_tool = getattr(self, 'portal_activities', None) activity_tool = getattr(self, 'portal_activities', None)
if activity_tool is None: return self # Do nothing if no portal_activities if activity_tool is None: return self # Do nothing if no portal_activities
# activate returns an ActiveWrapper # activate returns an ActiveWrapper
# a queue can be provided as well as extra parameters # a queue can be provided as well as extra parameters
# which can be used for example to define deferred tasks # which can be used for example to define deferred tasks
try: try:
# This volatile variable '_v_activate_kw' can be used to pass parameters
# automatically to activate.
if hasattr(self, '_v_activate_kw'):
kw.update(self._v_activate_kw)
return activity_tool.activate(self, activity, active_process, **kw) return activity_tool.activate(self, activity, active_process, **kw)
except ConflictError: except ConflictError:
raise raise
......
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