Commit 8142ee99 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Rewrote getVariationCategoryItemList using getVariationCategoryList for consistency.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@151 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 30c238ce
...@@ -71,18 +71,22 @@ class Variated(Base): ...@@ -71,18 +71,22 @@ class Variated(Base):
def getVariationCategoryItemList(self, base_category_list = (), base=1, def getVariationCategoryItemList(self, base_category_list = (), base=1,
method_id='getTitle', start_with_item=None): method_id='getTitle', start_with_item=None):
""" """
Returns the list of possible variations Returns the list of possible variation items
""" """
if base_category_list is (): variation_category_item_list = []
base_category_list = self.getVariationRangeBaseCategoryList() if start_with_item is not None:
variation_category_item_list.append(start_with_item)
variation_category_list = self.getVariationCategoryList(base_category_list=base_category_list)
for variation_category in variation_category_list:
resource = self.portal_categories.resolveCategory(variation_category)
value = getattr(resource, method_id)()
if base: if base:
return map(lambda x:(x.getTitle(), label = variation_category
'/'.join(x.getPhysicalPath()[len(x.portal_categories.getPhysicalPath()):])),
self._getValueList(base_category_list))
else: else:
return map(lambda x:(x.getTitle(), index = variation_category.find('/') + 1
'/'.join(x.getPhysicalPath()[1+len(x.portal_categories.getPhysicalPath()):])), label = variation_category[index:]
self._getValueList(base_category_list)) variation_category_item_list.append((label, value))
return variation_category_item_list
security.declareProtected(Permissions.ModifyPortalContent, '_setVariationCategoryList') security.declareProtected(Permissions.ModifyPortalContent, '_setVariationCategoryList')
def _setVariationCategoryList(self, node_list, base_category_list = ()): def _setVariationCategoryList(self, node_list, base_category_list = ()):
...@@ -184,6 +188,9 @@ class Variated(Base): ...@@ -184,6 +188,9 @@ class Variated(Base):
clist = [(None,None)] clist = [(None,None)]
return clist return clist
# Missing methods
# getVariationBaseCategoryItemList
# Help # Help
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getMatrixVariationRangeBaseCategoryList') 'getMatrixVariationRangeBaseCategoryList')
......
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