[MERGE] raise an exception if it can't evaluate a string
authorStephane Wirtel <stw@openerp.com>
Tue, 11 Sep 2012 14:53:25 +0000 (16:53 +0200)
committerStephane Wirtel <stw@openerp.com>
Tue, 11 Sep 2012 14:53:25 +0000 (16:53 +0200)
bzr revid: stw@openerp.com-20120911145325-oay33de4o7h83k4t

1  2 
openerp/tools/convert.py

@@@ -140,15 -134,16 +139,16 @@@ def _eval_xml(self, node, pool, cr, uid
              try:
                  return unsafe_eval(a_eval, idref2)
              except Exception:
-                 _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
 +        def _process(s, idref):
 +            m = re.findall('[^%]%\((.*?)\)[ds]', s)
 +            for id in m:
 +                if not id in idref:
 +                    idref[id]=self.id_get(cr, id)
 +            return s % idref
          if t == 'xml':
 -            def _process(s, idref):
 -                m = re.findall('[^%]%\((.*?)\)[ds]', s)
 -                for id in m:
 -                    if not id in idref:
 -                        idref[id]=self.id_get(cr, id)
 -                return s % idref
              _fix_multiple_roots(node)
              return '<?xml version="1.0"?>\n'\
                  +_process("".join([etree.tostring(n, encoding='utf-8')