Commit 770e78d1 authored by Alexandre Boeglin's avatar Alexandre Boeglin

If Category-optimized version of isMemberOf returns 0,

we now also try the generic version, as categories can be members of
categories belonging to a different base category.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3004 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 50a6e1d1
...@@ -969,8 +969,9 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -969,8 +969,9 @@ class CategoryTool( UniqueObject, Folder, Base ):
and the other which does not. A complete review of and the other which does not. A complete review of
the use of isMemberOf is required the use of isMemberOf is required
""" """
if getattr(aq_base(context), 'isCategory', 0): if getattr(aq_base(context), 'isCategory', 0) :
return context.isMemberOf(category, strict=strict) if context.isMemberOf(category, strict=strict) == 1 :
return 1
base_category = category.split('/')[0] # Extract base_category for optimisation base_category = category.split('/')[0] # Extract base_category for optimisation
if strict: if strict:
for c in self.getAcquiredCategoryMembershipList(context, base_category = base_category): for c in self.getAcquiredCategoryMembershipList(context, base_category = base_category):
......
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