[Erp5-report] r31504 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/Transformation.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 29 03:06:07 CET 2009


Author: nicolas.dumazet
Date: Tue Dec 29 03:06:05 2009
New Revision: 31504

URL: http://svn.erp5.org?rev=31504&view=rev
Log:
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.

Modified:
    erp5/trunk/products/ERP5/Document/Transformation.py

Modified: erp5/trunk/products/ERP5/Document/Transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Transformation.py?rev=31504&r1=31503&r2=31504&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py [utf8] Tue Dec 29 03:06:05 2009
@@ -204,18 +204,21 @@
         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,




More information about the Erp5-report mailing list