From f77f05d99670a16e91db4207d9c20fde56999d1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 1 Dec 2005 15:35:19 +0000
Subject: [PATCH] added getCategoryChildTranslatedTitleItemList,
 getCategoryChildTranslatedLogicalPathItemList

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4453 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFCategory/Category.py | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/product/CMFCategory/Category.py b/product/CMFCategory/Category.py
index 445f043a86..954a7627de 100755
--- a/product/CMFCategory/Category.py
+++ b/product/CMFCategory/Category.py
@@ -150,7 +150,7 @@ class Category(Folder):
 
     security.declareProtected(Permissions.AccessContentsInformation,
                                                     'getLogicalPath')
-    def getLogicalPath(self):
+    def getLogicalPath(self, item_method = 'getTitle'):
       """
         Returns logical path, starting under base category.
       """
@@ -164,12 +164,18 @@ class Category(Folder):
       # it s better for the user to display something than only ''...
       logical_title_list = []
       for object in objectlist:
-        logical_title = object.getTitle()
+        logical_title = getattr(object, item_method)()
         if logical_title in [None, '']:
           logical_title = object.getId()
         logical_title_list.append(logical_title)
       return '/'.join(logical_title_list)
 
+    def getTranslatedLogicalPath(self):
+      """
+        Returns translated logical path, started under base category.
+      """
+      return self.getLogicalPath(item_method='getTranslatedTitle')
+
     security.declareProtected(Permissions.AccessContentsInformation,
                                                     'getIndentedTitle')
     def getIndentedTitle(self):
@@ -260,6 +266,16 @@ class Category(Folder):
       """
       return self.getCategoryChildItemList(recursive = recursive, display_id='title', base=base, **kw)
 
+    security.declareProtected(Permissions.AccessContentsInformation,
+                                    'getCategoryChildTranslatedTitleItemList')
+    def getCategoryChildTranslatedTitleItemList(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
+      """
+      return self.getCategoryChildItemList(recursive = recursive,
+                      display_id='translated_title', base=base, **kw)
+
     security.declareProtected(Permissions.AccessContentsInformation,
                                                       'getCategoryChildTitleOrIdItemList')
     def getCategoryChildTitleOrIdItemList(self, recursive=1, base=0, **kw):
@@ -277,6 +293,15 @@ class Category(Folder):
       given list of base categories. Uses getLogicalPath as default method
       """
       return self.getCategoryChildItemList(recursive = recursive, display_id='logical_path', base=base, **kw)
+    
+    def getCategoryChildTranslatedLogicalPathItemList(self, recursive=1, base=0, **kw):
+      """
+      Returns a list of tuples by parsing recursively all categories in a
+      given list of base categories. Uses translation of getLogicalPath
+      as default method
+      """
+      return self.getCategoryChildItemList(recursive = recursive,
+                               display_id='translated_logical_path', base=base, **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation,
                                                       'getCategoryChildIndentedTitleItemList')
-- 
2.30.9