Commit 9623656d authored by Julien Muchembled's avatar Julien Muchembled

CMFCategory: fix several *TitleItem* & *IdItem* getters

'display_id' expects a property name and 'display_method' a method name
parent e2c363bb
...@@ -743,7 +743,7 @@ class Category(Folder): ...@@ -743,7 +743,7 @@ class Category(Folder):
""" """
Returns a list of objects or brains Returns a list of objects or brains
""" """
kw['display_id'] = 'getTitle' kw['display_id'] = 'title'
kw['display_method'] = None kw['display_method'] = None
return self.portal_categories.getCategoryMemberItemList(self, **kw) return self.portal_categories.getCategoryMemberItemList(self, **kw)
......
...@@ -421,35 +421,26 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -421,35 +421,26 @@ class CategoryTool( UniqueObject, Folder, Base ):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildTitleItemList') 'getCategoryChildTitleItemList')
def getCategoryChildTitleItemList(self, base_category=None, def getCategoryChildTitleItemList(self, base_category=None, *args, **kw):
recursive=1, base=0, display_none_category=0, sort_id=None):
""" """
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 getTitle as default method given list of base categories. Uses getTitle as default method
""" """
return self.getCategoryChildItemList(base_category=base_category, recursive = recursive,base=base, return self.getCategoryChildItemList(base_category, 'title', *args, **kw)
display_none_category=display_none_category,display_id='getTitle', sort_id=sort_id)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildIdItemList') 'getCategoryChildIdItemList')
def getCategoryChildIdItemList(self, base_category=None, def getCategoryChildIdItemList(self, base_category=None, *args, **kw):
recursive=1, base=0, display_none_category=0, sort_id=None):
""" """
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( return self.getCategoryChildItemList(base_category, 'id', *args, **kw)
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, **kw): recursive=1, base=0, display_none_category=1, **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::
...@@ -484,11 +475,12 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -484,11 +475,12 @@ 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.extend(category.getCategoryChildItemList( result += category.getCategoryChildItemList(
base=base, base=base,
recursive=recursive, recursive=recursive,
display_id=display_id, display_id=display_id,
**kw )) display_none_category=0,
**kw)
return result return result
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -1681,7 +1673,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1681,7 +1673,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
return self.getCategoryMemberItemList(self, context, base_category = base_category, return self.getCategoryMemberItemList(self, context, base_category = base_category,
spec = spec, filter=filter, portal_type=portal_type, spec = spec, filter=filter, portal_type=portal_type,
strict_membership = strict_membership, strict = strict, strict_membership = strict_membership, strict = strict,
display_id = 'getTitle') display_id = 'title')
security.declarePublic('resolveCategory') security.declarePublic('resolveCategory')
def resolveCategory(self, relative_url, default=_marker): def resolveCategory(self, relative_url, default=_marker):
......
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