[FIX] don't *eval* field names to get the field type associated with a function field

bzr revid: xmo@openerp.com-20110909141541-p172s7jqu597sjc9
This commit is contained in:
Xavier Morel
2011-09-09 16:15:41 +02:00
parent f59aaf7ca0
commit 09b63ae6ea
+3 -3
View File
@@ -514,9 +514,9 @@ def get_pg_type(f):
f_type = ('int4', 'INTEGER')
else:
f_type = ('varchar', 'VARCHAR(%d)' % f_size)
elif isinstance(f, fields.function) and eval('fields.'+(f._type), globals()) in type_dict:
t = eval('fields.'+(f._type), globals())
f_type = (type_dict[t], type_dict[t])
elif isinstance(f, fields.function) and getattr(fields, f._type, None) in type_dict:
t = type_dict[getattr(fields, f._type)]
f_type = (t, t)
elif isinstance(f, fields.function) and f._type == 'float':
if f.digits:
f_type = ('numeric', 'NUMERIC')