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