Commit f85c9689 authored by Jean-Paul Smets's avatar Jean-Paul Smets

faster detection of infinite loop in category acquisition


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@815 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5599aa0e
......@@ -755,13 +755,29 @@ class CategoryTool( UniqueObject, Folder, Base ):
if acquired_object_dict is None:
acquired_object_dict = {}
context_base_key = (tuple(context.getPhysicalPath()), base_category)
if context_base_key in acquired_object_dict:
type_dict = acquired_object_dict[context_base_key]
if spec is ():
if () in type_dict:
return []
else:
type_dict[()] = 1
else:
context_key = (tuple(context.getPhysicalPath()), base_category, tuple(spec)) # Prevents recursion in category acquisition
if context_key in acquired_object_dict:
# Stop recursion if this object if already used
for pt in spec:
if pt in type_dict:
return []
else:
acquired_object_dict[context_key] = 1
type_dict[pt] = 1
else:
type_dict = {}
if spec is ():
type_dict[()] = 1
else:
for pt in spec:
type_dict[pt] = 1
acquired_object_dict[context_base_key] = type_dict
result = self.getSingleCategoryMembershipList( context, base_category, base=base,
spec=spec, filter=filter, **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