Commit d74fcfcc authored by Julien Muchembled's avatar Julien Muchembled

Micro-optimize Base.isAncestryIndexable

parent 0e3b9820
...@@ -2844,15 +2844,16 @@ class Base( CopyContainer, ...@@ -2844,15 +2844,16 @@ class Base( CopyContainer,
""" """
Tells whether this document is indexable, taking into account its entire Tells whether this document is indexable, taking into account its entire
ancestry: a document may only be indexed if its parent is indexable, and ancestry: a document may only be indexed if its parent is indexable, and
it's parent's parent, etc until ERP5Site object (inclusive). its parent's parent, etc until ERP5Site object (inclusive).
""" """
node = self.aq_inner if self.isIndexable:
portal = aq_base(self.getPortalObject()) node = self.aq_inner.aq_parent
is_indexable = self.isIndexable portal = aq_base(node.getPortalObject())
while is_indexable and aq_base(node) is not portal: while node.isSubtreeIndexable():
if aq_base(node) is portal:
return True
node = node.aq_parent node = node.aq_parent
is_indexable = node.isSubtreeIndexable() return False
return is_indexable
security.declarePrivate('immediateReindexObject') security.declarePrivate('immediateReindexObject')
def immediateReindexObject(self, *args, **kw): def immediateReindexObject(self, *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