From 9e31b651e0b1776d437acd42c53b326e7beffe2c Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Fri, 13 Aug 2004 09:25:14 +0000
Subject: [PATCH] Removed getTitle (acquisition will be used). Added
 getCategoryChildLogicalPathItemList and fixed getCategoryChildItemList calls.

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

diff --git a/product/CMFCategory/Category.py b/product/CMFCategory/Category.py
index 409d3735f2..2f7ddc3f6b 100755
--- a/product/CMFCategory/Category.py
+++ b/product/CMFCategory/Category.py
@@ -147,16 +147,18 @@ class Category(Folder):
         return meta_types
 
     security.declareProtected(Permissions.AccessContentsInformation,
-                                                    'getTitle')
-    def getTitle(self):
+                                                    'getLogicalPath')
+    def getLogicalPath(self):
       """
-        Returns title is not empty or relative_url
+        Returns logical path, starting under base category.
       """
-      title = getattr(self, 'title', '')
-      if title != '' and title is not None:
-        return title
-      else:
-        return self.getCategoryRelativeUrl()
+      objectlist = []
+      base = self.getBaseCategory()
+      current = self
+      while not current is base :
+        objectlist.insert(0, current)
+        current = aq_parent(current)
+      return '/'.join([object.getTitle() for object in objectlist])
 
     security.declareProtected(Permissions.AccessContentsInformation,
                                                     'getCategoryChildValueList')
@@ -204,7 +206,16 @@ class Category(Folder):
       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='getTitle', base=base, **kw)
+      return self.getCategoryChildItemList(recursive = recursive, display_id='title', base=base, **kw)
+
+    security.declareProtected(Permissions.AccessContentsInformation,
+                                                      'getCategoryChildLogicalPathItemList')
+    def getCategoryChildLogicalPathItemList(self, recursive=1, base=0, **kw):
+      """
+      Returns a list of tuples by parsing recursively all categories in a
+      given list of base categories. Uses getLogicalPath as default method
+      """
+      return self.getCategoryChildItemList(recursive = recursive, display_id='logical_path', base=base, **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation,
                                                       'getCategoryChildIdItemList')
@@ -213,7 +224,7 @@ class Category(Folder):
       Returns a list of tuples by parsing recursively all categories in a
       given list of base categories. Uses getId as default method
       """
-      return self.getCategoryChildItemList(recursive = recursive, display_id='getId', base=base, **kw)
+      return self.getCategoryChildItemList(recursive = recursive, display_id='id', base=base, **kw)
 
 
     security.declareProtected(Permissions.AccessContentsInformation,
-- 
2.30.9