From 7d9e3b7c1648b290eb56f448e67f2447a5b2b798 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Fri, 26 Sep 2008 10:28:27 +0300 Subject: [PATCH] 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 --- bin/tools/convert.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 0b073127420..24a14c840b1 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -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)