Commit 28269103 authored by Nicolas Dumazet's avatar Nicolas Dumazet

getVariationCategoryItemList: walk only once the resource list

Filter on portal type and store items in correct lists, instead of using
two distinct list comprehensions based on the same initial list.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31504 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 30030831
......@@ -204,18 +204,21 @@ class Transformation(XMLObject, Predicate, Variated):
variation_category_list = self.getVariationCategoryList(
base_category_list=[base_category])
resource_list = [self.portal_categories.resolveCategory(x) for x in\
variation_category_list]
category_list = [x for x in resource_list \
if x.getPortalType() == 'Category']
category_list = []
object_list = []
for variation_category in variation_category_list:
resource = self.portal_categories.resolveCategory(variation_category)
if resource.getPortalType() == 'Category':
category_list.append(resource)
else:
object_list.append(resource)
variation_category_item_list.extend(Renderer(
is_right_display=0,
display_none_category=0, base=base,
current_category=current_category,
display_id='logical_path',**kw).\
render(category_list))
object_list = [x for x in resource_list \
if x.getPortalType() != 'Category']
variation_category_item_list.extend(Renderer(
is_right_display=0,
base_category=base_category,
......
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