[Erp5-report] r11565 - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Dec 1 11:19:06 CET 2006


Author: romain
Date: Fri Dec  1 11:19:04 2006
New Revision: 11565

URL: http://svn.erp5.org?rev=11565&view=rev
Log:
Add getTranslatedTitleOrId.

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=11565&r1=11564&r2=11565&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Fri Dec  1 11:19:04 2006
@@ -1732,8 +1732,9 @@
     """
       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:
@@ -1749,6 +1750,21 @@
     """Returns the title and the id in parenthesis
     """
     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')




More information about the Erp5-report mailing list