Commit 62660554 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

revise the implementation of getting the root document path.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19592 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db3db354
...@@ -2713,30 +2713,22 @@ class Base( CopyContainer, ...@@ -2713,30 +2713,22 @@ class Base( CopyContainer,
self.activate(group_method_id='portal_catalog/catalogObjectList', self.activate(group_method_id='portal_catalog/catalogObjectList',
alternate_method_id='alternateReindexObject', alternate_method_id='alternateReindexObject',
group_id=group_id, group_id=group_id,
serialization_tag=self.getRootDocument(), serialization_tag=self.getRootDocumentPath(),
**activate_kw).immediateReindexObject(**kw) **activate_kw).immediateReindexObject(**kw)
security.declarePublic('recursiveReindexObject') security.declarePublic('recursiveReindexObject')
recursiveReindexObject = reindexObject recursiveReindexObject = reindexObject
def getRootDocument(self): def getRootDocumentPath(self):
result = self.getRootDocumentValue() # if document, return the path of its root document
if result is not None: # otherwire, return None
result = result.getPath() self_path_list = self.getPhysicalPath()
return result self_depth = len(self_path_list)
portal_depth = len(self.getPortalObject().getPhysicalPath())
def getRootDocumentValue(self): if self_depth > portal_depth + 1:
result = None return '/'.join(self_path_list[:portal_depth + 2])
parent_value = self.getParentValue()
if parent_value is not None:
parent_id = parent_value.getId()
if parent_id.endswith('_module') or parent_id.startswith('portal_'):
result = self
else: else:
getRootDocumentValue = getattr(parent_value, 'getRootDocumentValue', None) return None
if getRootDocumentValue is not None:
result = getRootDocumentValue()
return result
security.declareProtected( Permissions.AccessContentsInformation, 'getIndexableChildValueList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getIndexableChildValueList' )
def getIndexableChildValueList(self): def getIndexableChildValueList(self):
......
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