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():
node = node.aq_parent if aq_base(node) is portal:
is_indexable = node.isSubtreeIndexable() return True
return is_indexable node = node.aq_parent
return False
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