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

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 28 09:45:24 CET 2009


Author: nicolas.dumazet
Date: Mon Dec 28 09:45:23 2009
New Revision: 31477

URL: http://svn.erp5.org?rev=31477&view=rev
Log:
getAggregatedAmountList: iterate and filter instead of expand and filter

It is not necessary to build the entire list of transformation lines,
we can just examine and filter each line, as they are yielded

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=31477&r1=31476&r2=31477&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py [utf8] Mon Dec 28 09:45:23 2009
@@ -245,19 +245,6 @@
                            with the quantity of the context
       """
       context = self.asContext(context=context, REQUEST=REQUEST, **kw)
-      # First we need to get the list of transformations which this 
-      # transformation depends on
-      # At this moment, we only consider 1 dependency
-      template_transformation_list = self.getSpecialiseValueList()
-      result = AggregatedAmountList()
-
-      # Browse all involved transformations and create one line per 
-      # line of transformation
-      # Currently, we do not consider abstractions, we just add 
-      # whatever we find in all transformations
-      transformation_line_list = []
-      for transformation in ([self]+template_transformation_list):
-        transformation_line_list.extend(transformation.objectValues())
 
       # A list of functions taking a transformation_line as sole argument
       # and returning True iif the line should be kept in the result
@@ -295,11 +282,22 @@
             return False
         return True
 
-      for transformation_line in transformation_line_list:
-        # Browse each transformed or assorted resource of the current
-        # transformation
-        if line_is_included(transformation_line):
-          result.extend(transformation_line.getAggregatedAmountList(context))
+      # First we need to get the list of transformations which this
+      # transformation depends on
+      # At this moment, we only consider 1 dependency
+      template_transformation_list = self.getSpecialiseValueList()
+
+      # Browse all involved transformations and create one line per
+      # line of transformation
+      # Currently, we do not consider abstractions, we just add
+      # whatever we find in all transformations
+      result = AggregatedAmountList()
+      for transformation in ([self] + template_transformation_list):
+        for transformation_line in transformation.objectValues():
+          # Browse each transformed or assorted resource of the current
+          # transformation
+          if line_is_included(transformation_line):
+            result.extend(transformation_line.getAggregatedAmountList(context))
 
       if context_quantity:
         result.multiplyQuantity(context=context)




More information about the Erp5-report mailing list