Commit 591e849e authored by Jérome Perrin's avatar Jérome Perrin

make hasTitle work as expected on persons

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34066 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 548a06fb
...@@ -148,6 +148,11 @@ class Person(XMLObject): ...@@ -148,6 +148,11 @@ class Person(XMLObject):
def title_or_id(self): def title_or_id(self):
return self.getTitleOrId() return self.getTitleOrId()
security.declareProtected(Permissions.AccessContentsInformation,
'hasTitle')
def hasTitle(self):
return not not self.getTitle()
def _setFirstName(self, value): def _setFirstName(self, value):
""" """
Update Title if first_name is modified Update Title if first_name is modified
......
...@@ -134,6 +134,12 @@ class TestPerson(ERP5TypeTestCase): ...@@ -134,6 +134,12 @@ class TestPerson(ERP5TypeTestCase):
self.assertEquals('first last', p.getTitleOrId()) self.assertEquals('first last', p.getTitleOrId())
self.assertEquals('first last', p.title_or_id()) self.assertEquals('first last', p.title_or_id())
def testHasTitle(self):
p = self._makeOne('person')
self.assertFalse(p.hasTitle())
p.setFirstName('bob')
self.assertTrue(p.hasTitle())
def testSetPasswordSecurity(self): def testSetPasswordSecurity(self):
p = self._makeOne('person') p = self._makeOne('person')
p.manage_permission(Permissions.SetOwnPassword, [], 0) p.manage_permission(Permissions.SetOwnPassword, [], 0)
......
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