[FIX] don't just print a warning if an @eval fails in an XML file

bzr revid: xmo@openerp.com-20120126133013-5fnsouix8cutwlik
This commit is contained in:
Xavier Morel 2012-01-26 14:30:13 +01:00
parent 3049760fe6
commit 5c40627e4b
1 changed files with 3 additions and 4 deletions

View File

@ -129,15 +129,14 @@ def _eval_xml(self, node, pool, cr, uid, idref, context=None):
f_val = f_val[0]
return f_val
a_eval = node.get('eval','')
idref2 = {}
if a_eval:
idref2 = _get_idref(self, cr, uid, f_model, context, idref)
try:
return unsafe_eval(a_eval, idref2)
except Exception:
logger = logging.getLogger('init')
logger.warning('could not eval(%s) for %s in %s' % (a_eval, node.get('name'), context), exc_info=True)
return ""
logging.getLogger('openerp.tools.convert.init').error(
'Could not eval(%s) for %s in %s', a_eval, node.get('name'), context)
raise
if t == 'xml':
def _process(s, idref):
m = re.findall('[^%]%\((.*?)\)[ds]', s)