Commit b6e2adfc authored by Romain Courteaud's avatar Romain Courteaud

Add getTranslatedTitleOrId.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11565 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3b0deb73
......@@ -1732,8 +1732,9 @@ class Base( CopyContainer,
"""
Returns the title or the id if the id is empty
"""
if self.getTitle()is not None:
title = str(self.getTitle())
title = self.getTitle()
if title is not None:
title = str(title)
if title == '' or title is None:
return self.getId()
else:
......@@ -1750,6 +1751,21 @@ class Base( CopyContainer,
"""
return self.title_and_id()
security.declareProtected(Permissions.AccessContentsInformation,
'getTranslatedTitleOrId')
def getTranslatedTitleOrId(self):
"""
Returns the translated title or the id if the id is empty
"""
title = self.getTranslatedTitle()
if title is not None:
title = str(title)
if title == '' or title is None:
return self.getId()
else:
return title
return self.getId()
# 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