Reduce fatal exception to a warning for 'eval'

If the data xml contains an eval expression that does not compute,
the convert procedure would throw an exception all the way up. Now,
catch that and only display a warning.

Hopefully, this warning will be fixed to contain more useful info
about its nature.

bzr revid: p_christ@hol.gr-20080926072827-41i7lihw2i9uaisk
This commit is contained in:
P. Christeas 2008-09-26 10:28:27 +03:00
parent c9bef54c28
commit 7d9e3b7c16
1 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,12 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None):
all_timezones=[]
pytz=pytzclass()
idref['pytz'] = pytz
return eval(a_eval, idref)
try:
return eval(a_eval, idref)
except:
logger = netsvc.Logger()
logger.notifyChannel("init", netsvc.LOG_WARNING, 'could eval(%s) for %s in %s, please get back and fix it!' % (a_eval,node.getAttribute('name'),context))
return ""
if t == 'xml':
def _process(s, idref):
m = re.findall('[^%]%\((.*?)\)[ds]', s)