From a8116b7748bb2b934886a2544f287f5ec4e69c0a Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Thu, 5 Nov 2009 04:29:45 +0000
Subject: [PATCH] getMeasureRowList: call asCatalogRowList only if we later
 keep the measure

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30313 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Resource.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py
index 4710ffdfbd..92b033f2ad 100644
--- a/product/ERP5/Document/Resource.py
+++ b/product/ERP5/Document/Resource.py
@@ -874,15 +874,16 @@ class Resource(XMLMatrix, Variated):
       for measure in self.getMeasureList():
         metric_type = measure.getMetricType()
         if metric_type in metric_type_map:
-          metric_type_map[metric_type] = ()
+          metric_type_map[metric_type] = None
         else:
-          metric_type_map[metric_type] = measure.asCatalogRowList()
+          metric_type_map[metric_type] = measure
         if measure.getRelativeUrl() == default:
           quantity_unit = ''
 
       insert_list = []
-      for measure_list in metric_type_map.itervalues():
-        insert_list += measure_list
+      for measure in metric_type_map.itervalues():
+        if measure is not None:
+          insert_list += measure.asCatalogRowList()
 
       metric_type = quantity_unit.split('/', 1)[0]
       if metric_type and metric_type not in metric_type_map:
-- 
2.30.9