Commit 876573bc authored by Sebastien Robin's avatar Sebastien Robin

modified asItemList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2844 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 70aa8462
...@@ -411,8 +411,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -411,8 +411,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
# Category to Tuple Conversion # Category to Tuple Conversion
security.declareProtected(Permissions.View, 'asItemList') security.declareProtected(Permissions.View, 'asItemList')
def asItemList(self, relative_url, base_category=None, def asItemList(self, relative_url, base_category=None,**kw):
display_id = None, base = 0, sort_id=None):
""" """
Returns a list of tuples, each tuple is calculated by applying Returns a list of tuples, each tuple is calculated by applying
display_id on each category provided in relative_url display_id on each category provided in relative_url
...@@ -430,27 +429,25 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -430,27 +429,25 @@ class CategoryTool( UniqueObject, Folder, Base ):
recursive -- if set to 0 do not apply recursively recursive -- if set to 0 do not apply recursively
""" """
result = [] #if display_id is None:
if display_id is None: # for c in relative_url:
for c in relative_url: # result += [(c, c)]
result += [(c, c)] #else:
else: LOG('CMFCategoryTool.asItemList, relative_url',0,relative_url)
value_list = []
for c in relative_url: for c in relative_url:
o = self.getCategoryValue(c, base_category=base_category) o = self.getCategoryValue(c, base_category=base_category)
LOG('CMFCategoryTool.asItemList, (o,c)',0,(o,c))
if o is not None: if o is not None:
try: value_list.append(o)
v = getattr(o, display_id)()
result = result + [(c,v)]
except:
LOG('WARNING: CategoriesTool',0, 'Unable to call %s on %s' %
(method, c))
else: else:
LOG('WARNING: CategoriesTool',0, 'Unable to find category %s' % c) LOG('WARNING: CategoriesTool',0, 'Unable to find category %s' % c)
#if sort_id is not None: #if sort_id is not None:
# result.sort() # result.sort()
return result LOG('CMFCategoryTool.asItemList, value_list',0,value_list)
return Renderer(base_category=base_category,**kw).render(value_list)
security.declareProtected(Permissions.View, 'getItemList') security.declareProtected(Permissions.View, 'getItemList')
getItemList = asItemList getItemList = asItemList
......
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