[IMP] yaml_import: enforce ISO date format for date[time] fields in yml tests, to execute locale-agnostic tests

bzr revid: odo@openerp.com-20100916144644-thsb8624du8ik6rn
This commit is contained in:
Olivier Dony
2010-09-16 16:46:44 +02:00
parent 504c545cd7
commit 24ff6d033b
+8
View File
@@ -374,6 +374,14 @@ class YamlInterpreter(object):
elif column._type == "many2many":
ids = [self.get_id(xml_id) for xml_id in expression]
value = [(6, 0, ids)]
elif column._type == "date":
# enforce ISO format for date values, to be locale-agnostic during tests
time.strptime(expression, "%Y-%m-%d")
value = expression
elif column._type == "datetime":
# enforce ISO format for date values, to be locale-agnostic during tests
time.strptime(expression, "%Y-%m-%d %H:%M:%S")
value = expression
else: # scalar field
if is_eval(expression):
value = self.process_eval(expression)