[REF] code review by odo

bzr revid: qdp-launchpad@openerp.com-20121010104220-nqi6c12ua7tnaejt
This commit is contained in:
Quentin (OpenERP) 2012-10-10 12:42:20 +02:00
parent 90fc4d6651
commit f4f3d6fa15
1 changed files with 4 additions and 2 deletions

View File

@ -1733,11 +1733,13 @@ class BaseModel(object):
field = model_fields.get(node.get('name'))
if field:
transfer_field_to_modifiers(field, modifiers)
#evaluate the options as python code, but send it as json to the client
if node.get('options'):
try:
node.set('options', simplejson.dumps(literal_eval(node.get('options'))))
except Exception, msg:
raise except_orm('Invalide Python code in %s'%(node.get('options')), msg[0])
except Exception, e:
_logger.exception('Invalid `options´ attribute, should be a valid python expression: %r', node.get('options'))
raise except_orm('Invalid options', 'Invalid options: %r %s' % (node.get('options'), e))
elif node.tag in ('form', 'tree'):
result = self.view_header_get(cr, user, False, node.tag, context)