From b405ca1c1c3689c99b511f71a333d6ebe8ba525b Mon Sep 17 00:00:00 2001
From: Guillaume Michon <guillaume@nexedi.com>
Date: Wed, 1 Mar 2006 14:43:10 +0000
Subject: [PATCH] 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
---
 product/CMFActivity/ActiveObject.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/product/CMFActivity/ActiveObject.py b/product/CMFActivity/ActiveObject.py
index ce667583a9..d5f6cbb6ae 100755
--- a/product/CMFActivity/ActiveObject.py
+++ b/product/CMFActivity/ActiveObject.py
@@ -71,18 +71,24 @@ class ActiveObject(ExtensionClass.Base):
                             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:
-      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)
     if activity_tool is None: return self # Do nothing if no portal_activities
     # activate returns an ActiveWrapper
     # a queue can be provided as well as extra parameters
     # which can be used for example to define deferred tasks
     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)
     except ConflictError:
       raise
-- 
2.30.9