Commit 8a595e70 authored by Jérome Perrin's avatar Jérome Perrin

supports getCategoryChildTitleAndIdItemList, which uses Zope's title_and_id



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10242 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b37dea15
......@@ -288,10 +288,20 @@ class Category(Folder):
def getCategoryChildTitleOrIdItemList(self, recursive=1, base=0, **kw):
"""
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 getTitleOrId as default method
"""
return self.getCategoryChildItemList(recursive = recursive, display_id='title_or_id', base=base, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildTitleAndIdItemList')
def getCategoryChildTitleAndIdItemList(self, recursive=1, base=0, **kw):
"""
Returns a list of tuples by parsing recursively all categories in a
given list of base categories. Uses title_and_id as default method
"""
return self.getCategoryChildItemList(recursive=recursive,
display_id='title_and_id', base=base, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildLogicalPathItemList')
def getCategoryChildLogicalPathItemList(self, recursive=1, base=0, **kw):
......
......@@ -675,6 +675,15 @@ class TestCMFCategory(ERP5TypeTestCase):
strict_membership=1,
portal_type='Organisation')], [])
def test_20_CategoryChildTitleAndIdItemList(self, quiet=quiet,
run=run_all_test):
"""Tests getCategoryChildTitleAndIdItemList."""
base_cat = self.getCategoryTool().newContent(portal_type='Base Category')
cat = base_cat.newContent(portal_type='Category',
id='the_id', title='The Title')
self.assertEquals([['', ''], ['The Title (the_id)', 'the_id']],
base_cat.getCategoryChildTitleAndIdItemList())
if __name__ == '__main__':
framework()
else:
......
......@@ -1691,6 +1691,13 @@ class Base( CopyContainer, PortalContent, ActiveObject, Historical, ERP5Property
security.declareProtected( Permissions.View, 'Title' )
Title = getTitleOrId
security.declareProtected(Permissions.AccessContentsInformation,
'getTitleAndId')
def getTitleAndId(self):
"""Returns the title and the id in parenthesis
"""
return self.title_and_id()
# This method allows to sort objects in list is a more reasonable way
security.declareProtected(Permissions.View, 'getIntId')
def getIntId(self):
......
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