From 96f402af37d11779df4d6769edf69d8071157294 Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Thu, 29 Nov 2007 17:47:23 +0000 Subject: [PATCH] Added sort argument in getBaseCategoryList. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17909 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/CMFCategory/CategoryTool.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/product/CMFCategory/CategoryTool.py b/product/CMFCategory/CategoryTool.py index bfb0b9f08f..c2fb83bfef 100644 --- a/product/CMFCategory/CategoryTool.py +++ b/product/CMFCategory/CategoryTool.py @@ -150,7 +150,7 @@ class CategoryTool( UniqueObject, Folder, Base ): # Category accessors security.declareProtected(Permissions.AccessContentsInformation, 'getBaseCategoryList') - def getBaseCategoryList(self, context=None): + def getBaseCategoryList(self, context=None, sort=False): """ Returns the ids of base categories of the portal_categories tool if no context is provided, otherwise, returns the base categories @@ -163,9 +163,13 @@ class CategoryTool( UniqueObject, Folder, Base ): baseCategoryIds -- for zope users conveniance """ if context is None: - return self.objectIds() + result = self.objectIds() else: - return context._categories # XXX Incompatible with ERP5Type per portal type categories + # XXX Incompatible with ERP5Type per portal type categories + result = context._categories[:] + if sort: + result.sort() + return result security.declareProtected(Permissions.AccessContentsInformation, 'getBaseCategoryIds') getBaseCategoryIds = getBaseCategoryList -- 2.30.9