Commit 0f606620 authored by Sebastien Robin's avatar Sebastien Robin

make consistent the way to manage activate_kw while we call reindex, also...

make consistent the way to manage activate_kw while we call reindex, also remove flushActivity into Folder

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13528 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 43e2db66
......@@ -2205,13 +2205,17 @@ class Base( CopyContainer,
"""
self._reindexObject(*args, **kw)
def _reindexObject(self, *args, **kw):
def _reindexObject(self, activate_kw=None, **kw):
# When the activity supports group methods, portal_catalog/catalogObjectList is called instead of
# immediateReindexObject.
# Do not check if root is indexable, it is done into catalogObjectList,
# so we will save time
if activate_kw is None:
activate_kw = {}
if self.isIndexable:
self.activate(group_method_id='portal_catalog/catalogObjectList', alternate_method_id='alternateReindexObject', **kw).immediateReindexObject(*args, **kw)
self.activate(group_method_id='portal_catalog/catalogObjectList',
alternate_method_id='alternateReindexObject',
**activate_kw).immediateReindexObject(**kw)
security.declarePublic('recursiveReindexObject')
recursiveReindexObject = reindexObject
......
......@@ -563,7 +563,7 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
self.recursiveReindexObject()
security.declarePublic( 'recursiveReindexObject' )
def recursiveReindexObject(self, activate_kw={}, *args, **kw):
def recursiveReindexObject(self, activate_kw=None, **kw):
"""
Fixes the hierarchy structure (use of Base class)
XXXXXXXXXXXXXXXXXXXXXXXX
......@@ -575,7 +575,7 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
self.activate(group_method_id='portal_catalog/catalogObjectList',
expand_method_id='getIndexableChildValueList',
alternate_method_id='alternateReindexObject',
**activate_kw).recursiveImmediateReindexObject(*args, **kw)
**activate_kw).recursiveImmediateReindexObject(**kw)
security.declareProtected( Permissions.AccessContentsInformation,
'getIndexableChildValueList' )
......@@ -592,23 +592,19 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
return value_list
security.declarePublic( 'recursiveImmediateReindexObject' )
def recursiveImmediateReindexObject(self, *args, **kw):
def recursiveImmediateReindexObject(self, **kw):
"""
Applies immediateReindexObject recursively
"""
# Reindex self
root_indexable = int(getattr(self.getPortalObject(),'isIndexable',1))
if self.isIndexable and root_indexable:
# This might create a recursive lock
self.flushActivity(invoke=0, method_id='immediateReindexObject')
# This might create a recursive lock
self.flushActivity(invoke=0, method_id='recursiveImmediateReindexObject')
self.immediateReindexObject(*args, **kw)
self.immediateReindexObject(**kw)
# Reindex contents
for c in self.objectValues():
if getattr(aq_base(c),
'recursiveImmediateReindexObject', None) is not None:
c.recursiveImmediateReindexObject(*args, **kw)
c.recursiveImmediateReindexObject(**kw)
security.declareProtected( Permissions.ModifyPortalContent,
'recursiveMoveObject' )
......
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