Folder: call activate on the object instead of...
Folder: call activate on the object instead of portal_activities.activateObject in _recurseCallMethod(). so that activate_kw set on the object is respected.
-
Owner
How is activate_kw set on the object ? It's important to have same behaviour whether it's the first call of recurseCallMethod or if recurseCallMethod reexecuted itself.
/cc @vpelletier
-
Owner
There are two ways :
- newContent(activate_kw=...) (see ERP5Type.ERP5Type.constructInstance)
- call obj.setDefaultActivateParameterDict() directly
-
Owner
And ? How could these 2 ways happen when recurseCallMethod reexecuted itself ?
-
Owner
activate_kw is stored in a transactional variable cache, thus it is kept in recursively calling recurse() here. Do I miss something ?
BTW, I found that the following should be also part of this commit :
--- product/ERP5Type/Core/Folder.py +++ product/ERP5Type/Core/Folder.py @@ -522,7 +522,7 @@ class FolderMixIn(ExtensionClass.Base): raise activate_kw['group_method_id'] = kw['group_id'] = '' # no grouping activate_kw['activity'] = 'SQLQueue' - activate(self, **activate_kw)._recurseCallMethod( + self.activate(**activate_kw)._recurseCallMethod( method_id, method_args, method_kw, restricted=restricted, **kw) security.declarePublic('recurseCallMethod')
-
Owner
Do I miss something ?
Mainly that _recurseCallMethod does not create all activities in a single transaction. Once a limit is reached, it activates itself and the recursion continues in a different transaction, directly from CMFActivity. What I'm saying is that your change would only work if there aren't too many objects in the tree.
I also found that I wrote the following explanation in the docstring:
In order to activate objects that don't inherit ActiveObject, only placeless default activate parameters are taken into account.
You should be able to do what you want with
get_activate_kw_method_id
. I admit it may be harder to use. -
Owner
It's true that my comment about placeless default activate parameters is suspicious.
-
Owner
A unit test is definitely needed.