Commit 0720d767 authored by Sebastien Robin's avatar Sebastien Robin

the include_if_child parameter was only working on base category, not on category


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2461 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 073cd94b
...@@ -170,16 +170,19 @@ class Category(Folder): ...@@ -170,16 +170,19 @@ class Category(Folder):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildValueList') 'getCategoryChildValueList')
def getCategoryChildValueList(self, recursive=1,**kw): def getCategoryChildValueList(self, recursive=1,include_if_child=1,**kw):
""" """
List the child objects of this category and all its subcategories. List the child objects of this category and all its subcategories.
recursive - if set to 1, list recursively recursive - if set to 1, list recursively
""" """
value_list = [self] if not(include_if_child) and len(self.objectValues(self.allowed_types))>0:
value_list = []
else:
value_list = [self]
if recursive: if recursive:
for c in self.objectValues(self.allowed_types): for c in self.objectValues(self.allowed_types):
value_list.extend(c.getCategoryChildValueList(recursive = 1)) value_list.extend(c.getCategoryChildValueList(recursive = 1,include_if_child=include_if_child))
else: else:
for c in self.objectValues(self.allowed_types): for c in self.objectValues(self.allowed_types):
value_list.append(c) value_list.append(c)
...@@ -264,7 +267,7 @@ class Category(Folder): ...@@ -264,7 +267,7 @@ class Category(Folder):
recursive -- if set to 0 do not apply recursively recursive -- if set to 0 do not apply recursively
""" """
value_list = self.getCategoryChildValueList(recursive=recursive) value_list = self.getCategoryChildValueList(recursive=recursive,**kw)
return Renderer(base=base, **kw).render(value_list) return Renderer(base=base, **kw).render(value_list)
# Alias for compatibility # Alias for compatibility
...@@ -515,7 +518,7 @@ class BaseCategory(Category): ...@@ -515,7 +518,7 @@ class BaseCategory(Category):
value_list = [] value_list = []
if recursive: if recursive:
for c in self.objectValues(self.allowed_types): for c in self.objectValues(self.allowed_types):
value_list.extend(c.getCategoryChildValueList(recursive = 1)) value_list.extend(c.getCategoryChildValueList(recursive = 1,indlude_if_child=include_if_child))
else: else:
for c in self.objectValues(self.allowed_types): for c in self.objectValues(self.allowed_types):
if include_if_child: if include_if_child:
......
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