Commit e7b439e7 authored by Nicolas Dumazet's avatar Nicolas Dumazet

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
parent 12e67125
...@@ -217,7 +217,9 @@ class Measure(XMLMatrix): ...@@ -217,7 +217,9 @@ class Measure(XMLMatrix):
management_unit_quantity = getQuantity(management_unit_value) management_unit_quantity = getQuantity(management_unit_value)
if (not default or quantity == management_unit_quantity): 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 () return ()
if default: if default:
...@@ -302,10 +304,10 @@ class Measure(XMLMatrix): ...@@ -302,10 +304,10 @@ class Measure(XMLMatrix):
if quantity is None: if quantity is None:
continue continue
cell = quantity cell = quantity
row_list.append((uid, row_list.append(dict(uid=uid,
resource_uid, resource_uid=resource_uid,
'^%s$' % ''.join(regex_list), variation='^%s$' % ''.join(regex_list),
metric_type_uid, metric_type_uid=metric_type_uid,
cell * quantity_unit)) quantity=cell * quantity_unit))
return row_list return row_list
...@@ -967,7 +967,10 @@ class Resource(XMLMatrix, Variated): ...@@ -967,7 +967,10 @@ class Resource(XMLMatrix, Variated):
row_list = [] row_list = []
for unit_uid, value in self._getQuantityUnitDefinitionDict().iteritems(): for unit_uid, value in self._getQuantityUnitDefinitionDict().iteritems():
definition_uid, quantity = value 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 return row_list
...@@ -1062,7 +1065,9 @@ class Resource(XMLMatrix, Variated): ...@@ -1062,7 +1065,9 @@ class Resource(XMLMatrix, Variated):
.getCategoryUid(metric_type, 'metric_type') .getCategoryUid(metric_type, 'metric_type')
if quantity and metric_type_uid: if quantity and metric_type_uid:
uid = self.getUid() 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 return insert_list
......
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