Commit e5800a91 authored by Thierry's avatar Thierry

improved


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@73 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 168120b4
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
##bind namespace= ##bind namespace=
##bind script=script ##bind script=script
##bind subpath=traverse_subpath ##bind subpath=traverse_subpath
##parameters= ##parameters=base_category_list=['coloris','taille','morphologie','variante']
##title= ##title=
## ##
# returns a list of tuples combining possible variations # returns a list of tuples combining possible variations
...@@ -13,14 +13,15 @@ ...@@ -13,14 +13,15 @@
raw_variation_base_category_list = context.getVariationBaseCategoryList() raw_variation_base_category_list = context.getVariationBaseCategoryList()
variation_base_category_list = [] variation_base_category_list = []
for base_category in raw_variation_base_category_list : for base_category in raw_variation_base_category_list :
if base_category in ('coloris', 'taille', 'morphologie', 'variante') : if base_category in base_category_list :
variation_base_category_list.append(base_category) variation_base_category_list.append(base_category)
variation_base_category_list.sort() variation_base_category_list.sort()
variation_list_list = [] variation_list_list = []
for base_category in variation_base_category_list : for base_category in variation_base_category_list :
variation_list = context.getVariationCategoryList(base_category_list = (base_category,)) variation_list = map(lambda x:x[1], context.getVariationCategoryItemList(base_category_list=(base_category,)))
variation_list_list.append(variation_list) if variation_list != [] :
variation_list_list.append(variation_list)
cartesian_variation_list = context.cartesianProduct(variation_list_list) cartesian_variation_list = context.cartesianProduct(variation_list_list)
return cartesian_variation_list return cartesian_variation_list
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