From 09b63ae6ea0dfe2e173218097dde865d791ac529 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Sep 2011 16:15:41 +0200 Subject: [PATCH] [FIX] don't *eval* field names to get the field type associated with a function field bzr revid: xmo@openerp.com-20110909141541-p172s7jqu597sjc9 --- openerp/osv/orm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index b87672c012d..341f14e00e2 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -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')