[FIX] Replace views string interpolation by manual replacement.

No need to double % in views anymore

bzr revid: fme@openerp.com-20130806113626-t7y3v1trtfdtitar
This commit is contained in:
Fabien Meghazi
2013-08-06 13:36:26 +02:00
parent 81ae0babf2
commit 1b40e9265f
+15 -4
View File
@@ -151,11 +151,22 @@ def _eval_xml(self, node, pool, cr, uid, idref, context=None):
'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:
matches = re.finditer('[^%]%\((.*?)\)[ds]', s)
done = []
for m in matches:
found = m.group()[1:]
if found in done:
continue
done.append(found)
id = m.groups()[0]
if not id in idref:
idref[id]=self.id_get(cr, id)
return s % idref
idref[id] = self.id_get(cr, id)
s = s.replace(found, str(idref[id]))
s = s.replace('%%', '%') # Quite wierd but it's for (somewhat) backward compatibility sake
return s
if t == 'xml':
_fix_multiple_roots(node)
return '<?xml version="1.0"?>\n'\