Commit 5f5825fe authored by Jérome Perrin's avatar Jérome Perrin

CategoryTool.getCategoryChildItemList must propagate all kw args to

Category.getCategoryChildItemList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7473 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8d71a44c
...@@ -390,13 +390,18 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -390,13 +390,18 @@ class CategoryTool( UniqueObject, Folder, Base ):
Returns a list of tuples by parsing recursively all categories in a Returns a list of tuples by parsing recursively all categories in a
given list of base categories. Uses getId as default method given list of base categories. Uses getId as default method
""" """
return self.getCategoryChildItemList(base_category=base_category, recursive = recursive,base=base, return self.getCategoryChildItemList(
display_none_category=display_none_category,display_id='getId', sort_id=sort_id) base_category=base_category,
recursive = recursive,
base=base,
display_none_category=display_none_category,
display_id='getId',
sort_id=sort_id )
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildItemList') 'getCategoryChildItemList')
def getCategoryChildItemList(self, base_category=None, display_id = None, def getCategoryChildItemList(self, base_category=None, display_id = None,
recursive=1, base=0, display_none_category=1, sort_id=None): recursive=1, base=0, display_none_category=1, sort_id=None, **kw):
""" """
Returns a list of tuples by parsing recursively all categories in a Returns a list of tuples by parsing recursively all categories in a
given list of base categories. Each tuple contains:: given list of base categories. Each tuple contains::
...@@ -415,14 +420,15 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -415,14 +420,15 @@ class CategoryTool( UniqueObject, Folder, Base ):
display_id -- method called to build the couple display_id -- method called to build the couple
recursive -- if set to 0 do not apply recursively recursive -- if set to 0 do not apply recursively
See Category.getCategoryChildItemList for extra accepted arguments
""" """
if type(base_category) == type('a'): if isinstance(base_category, str):
base_category_list = [base_category] base_category_list = [base_category]
elif base_category is None: elif base_category is None:
base_category_list = self.getBaseCategoryList() base_category_list = self.getBaseCategoryList()
else: else:
base_category_list = base_category base_category_list = base_category
#LOG('getCategoryChildItemList', 0, str(base_category_list))
if display_none_category: if display_none_category:
result = [('', '')] result = [('', '')]
else: else:
...@@ -430,14 +436,15 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -430,14 +436,15 @@ class CategoryTool( UniqueObject, Folder, Base ):
for base_category in base_category_list: for base_category in base_category_list:
category = self[base_category] category = self[base_category]
if category is not None: if category is not None:
result += category.getCategoryChildItemList(base=base,recursive=recursive, result += category.getCategoryChildItemList(
display_id=display_id) base=base,
#if sort_id is not None: recursive=recursive,
# result.sort() display_id=display_id,
**kw )
return result return result
security.declareProtected(Permissions.AccessContentsInformation, 'getBaseItemList') security.declareProtected(Permissions.AccessContentsInformation,
'getBaseItemList')
getBaseItemList = getCategoryChildItemList getBaseItemList = getCategoryChildItemList
# Category to Tuple Conversion # Category to Tuple Conversion
......
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