Commit 1cd37609 authored by Julien Muchembled's avatar Julien Muchembled

Revert "Folder: call activate on the object instead of...

Revert "Folder: call activate on the object instead of portal_activities.activateObject in _recurseCallMethod()."

This reverts commits 3d3ec3cb ((+ fixup), which
broke recursion to objects that don't inherit ActiveObject, as explained in the
docstring.

I also think it was wrong in that default activate parameters disappear at the
end of the transaction whereas _recurseCallMethod may activate itself to avoid
creating to many activities at once. IOW, it's important that created
activities are the same no matter where _recurseCallMethod splits the browsing.

This change needed more review, as well as a unit test.
parents 1f73347c 63bd5a39
...@@ -449,6 +449,7 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -449,6 +449,7 @@ class FolderMixIn(ExtensionClass.Base):
activate_kw.update(kw.get('activate_kw', ())) activate_kw.update(kw.get('activate_kw', ()))
activate_kw.setdefault('active_process', None) activate_kw.setdefault('active_process', None)
activate_kw.setdefault('activity', 'SQLQueue') activate_kw.setdefault('activity', 'SQLQueue')
activate = self.getPortalObject().portal_activities.activateObject
validate = restricted and getSecurityManager().validate validate = restricted and getSecurityManager().validate
cost = activate_kw.setdefault('group_method_cost', .034) # 30 objects cost = activate_kw.setdefault('group_method_cost', .034) # 30 objects
if cost != 1: if cost != 1:
...@@ -512,7 +513,7 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -512,7 +513,7 @@ class FolderMixIn(ExtensionClass.Base):
del next_id[0] del next_id[0]
if min_depth <= depth: if min_depth <= depth:
check_limit() check_limit()
getattr(container.activate(**getActivateKw(container, recurse_activate_kw)), getattr(activate(container, **getActivateKw(container, recurse_activate_kw)),
method_id)(*method_args, **method_kw) method_id)(*method_args, **method_kw)
del recurse_stack[depth:] del recurse_stack[depth:]
try: try:
...@@ -522,8 +523,8 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -522,8 +523,8 @@ class FolderMixIn(ExtensionClass.Base):
raise raise
activate_kw['group_method_id'] = kw['group_id'] = '' # no grouping activate_kw['group_method_id'] = kw['group_id'] = '' # no grouping
activate_kw['activity'] = 'SQLQueue' activate_kw['activity'] = 'SQLQueue'
self.getPortalObject().portal_activities.activateObject(self, **activate_kw activate(self, **activate_kw)._recurseCallMethod(
)._recurseCallMethod(method_id, method_args, method_kw, restricted=restricted, **kw) method_id, method_args, method_kw, restricted=restricted, **kw)
security.declarePublic('recurseCallMethod') security.declarePublic('recurseCallMethod')
def recurseCallMethod(self, method_id, *args, **kw): def recurseCallMethod(self, method_id, *args, **kw):
......
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