From e7b439e70810c226b00bf0e54421853a8596373e Mon Sep 17 00:00:00 2001 From: Nicolas Dumazet <nicolas.dumazet@nexedi.com> Date: Wed, 3 Mar 2010 10:21:20 +0000 Subject: [PATCH] Pass dictionaries instead of tuples to indexing methods git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33321 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Measure.py | 14 ++++++++------ product/ERP5/Document/Resource.py | 9 +++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/product/ERP5/Document/Measure.py b/product/ERP5/Document/Measure.py index daa834a710..3e80e2bf65 100644 --- a/product/ERP5/Document/Measure.py +++ b/product/ERP5/Document/Measure.py @@ -217,7 +217,9 @@ class Measure(XMLMatrix): management_unit_quantity = getQuantity(management_unit_value) if (not default or quantity == management_unit_quantity): - return (uid, resource_uid, '^', metric_type_uid, quantity), + return (dict(uid=uid, resource_uid=resource_uid, + variation='^', metric_type_uid=metric_type_uid, + quantity=quantity)), return () if default: @@ -302,10 +304,10 @@ class Measure(XMLMatrix): if quantity is None: continue cell = quantity - row_list.append((uid, - resource_uid, - '^%s$' % ''.join(regex_list), - metric_type_uid, - cell * quantity_unit)) + row_list.append(dict(uid=uid, + resource_uid=resource_uid, + variation='^%s$' % ''.join(regex_list), + metric_type_uid=metric_type_uid, + quantity=cell * quantity_unit)) return row_list diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py index 6279410e8f..485765b2ff 100644 --- a/product/ERP5/Document/Resource.py +++ b/product/ERP5/Document/Resource.py @@ -967,7 +967,10 @@ class Resource(XMLMatrix, Variated): row_list = [] for unit_uid, value in self._getQuantityUnitDefinitionDict().iteritems(): definition_uid, quantity = value - row_list.append((definition_uid, uid, unit_uid, quantity)) + row_list.append(dict(uid=definition_uid, + resource_uid=uid, + quantity_unit_uid=unit_uid, + quantity=quantity)) return row_list @@ -1062,7 +1065,9 @@ class Resource(XMLMatrix, Variated): .getCategoryUid(metric_type, 'metric_type') if quantity and metric_type_uid: uid = self.getUid() - insert_list += (uid, uid, '^', metric_type_uid, float(quantity)), + insert_list.append(dict(uid=uid, resource_uid=uid, variation='^', + metric_type_uid=metric_type_uid, + quantity=float(quantity))) return insert_list -- 2.30.9