Commit c211422d authored by Jérome Perrin's avatar Jérome Perrin

Make it possible to configure the method used to display categories in

getVariationRangeCategoryItemList. For compatibility, it still defaults to
getCategoryChildLogicalPathItemList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19762 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7557fe81
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Context, Interface, Permissions from Products.ERP5Type import Context, Interface, Permissions
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.CMFCategory.Renderer import Renderer from Products.CMFCategory.Renderer import Renderer
...@@ -293,7 +295,8 @@ class Variated(Base): ...@@ -293,7 +295,8 @@ class Variated(Base):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationRangeCategoryItemList') 'getVariationRangeCategoryItemList')
def getVariationRangeCategoryItemList(self, base_category_list=(), base=1, def getVariationRangeCategoryItemList(self, base_category_list=(), base=1,
root=1, display_id='title', root=1,
display_method_id='getCategoryChildLogicalPathItemList',
display_base_category=1, display_base_category=1,
current_category=None, **kw): current_category=None, **kw):
""" """
...@@ -305,10 +308,11 @@ class Variated(Base): ...@@ -305,10 +308,11 @@ class Variated(Base):
base_category_list = self.getVariationBaseCategoryList() base_category_list = self.getVariationBaseCategoryList()
elif type(base_category_list) is type('a'): elif type(base_category_list) is type('a'):
base_category_list = (base_category_list, ) base_category_list = (base_category_list, )
traverse = getToolByName(self, 'portal_categories').unrestrictedTraverse
# Render categories # Render categories
for base_category in base_category_list: for base_category in base_category_list:
result += self.portal_categories.unrestrictedTraverse(base_category).\ result += getattr(traverse(base_category), display_method_id)(
getCategoryChildLogicalPathItemList(
base=base, base=base,
display_base_category=display_base_category, display_base_category=display_base_category,
display_none_category=0, **kw) display_none_category=0, **kw)
......
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