Commit 59c8aa67 authored by Jérome Perrin's avatar Jérome Perrin

fix title_or_id on person documents


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17382 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da741f7e
...@@ -118,6 +118,11 @@ class Person(XMLObject): ...@@ -118,6 +118,11 @@ class Person(XMLObject):
return ' '.join(name_list) return ' '.join(name_list)
else: else:
return self.title return self.title
security.declareProtected(Permissions.AccessContentsInformation,
'title_or_id')
def title_or_id(self):
return self.getTitleOrId()
security.declareProtected(Permissions.ModifyPortalContent, 'setTitle') security.declareProtected(Permissions.ModifyPortalContent, 'setTitle')
def setTitle(self, value): def setTitle(self, value):
......
...@@ -119,6 +119,17 @@ class TestPerson(ERP5TypeTestCase): ...@@ -119,6 +119,17 @@ class TestPerson(ERP5TypeTestCase):
last_name='last', last_name='last',
title='title' ) title='title' )
# no infinite loop :) but there's no guarantee on the behaviour # no infinite loop :) but there's no guarantee on the behaviour
def testGetTitleOrId(self):
p = self._makeOne('person')
self.assertEquals('person', p.getTitleOrId())
self.assertEquals('person', p.title_or_id())
p.edit( first_name='first',
last_name='last', )
self.assertEquals('first last', p.getTitleOrId())
self.assertEquals('first last', p.title_or_id())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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