[FIX] rml2pdf: _process_text escaping char for xml

lp bug: https://launchpad.net/bugs/885299 fixed

bzr revid: qdp-launchpad@openerp.com-20111104155759-e0tme9o3g1ef00tq
This commit is contained in:
Quentin (OpenERP) 2011-11-04 16:57:59 +01:00
parent 616950dce1
commit 1097bbeaca
2 changed files with 12 additions and 7 deletions

View File

@ -610,11 +610,10 @@ class _rml_flowable(object):
for key in txt_n.attrib.keys():
if key in ('rml_except', 'rml_loop', 'rml_tag'):
del txt_n.attrib[key]
if True or not self._textual(n).isspace():
if not n.tag == 'bullet':
txt_n.text = utils.xml2str(self._textual(n))
txt_n.tail = n.tail and utils._process_text(self, n.tail.replace('\n','')) or ''
rc1 += etree.tostring(txt_n)
if not n.tag == 'bullet':
txt_n.text = utils.xml2str(self._textual(n))
txt_n.tail = n.tail and utils.xml2str(utils._process_text(self, n.tail.replace('\n',''))) or ''
rc1 += etree.tostring(txt_n)
return rc1
def _table(self, node):

View File

@ -110,6 +110,12 @@ def _child_get(node, self=None, tagname=None):
yield n
def _process_text(self, txt):
'''
Translate a text and escape it for xml.
:param txt: text, varchar to process
:return: translated and escaped text
'''
if not self.localcontext:
return str2xml(txt)
if not txt:
@ -130,10 +136,10 @@ def _process_text(self, txt):
except Exception:
pass
if isinstance(txt, basestring):
result += str2xml(txt)
result += txt
elif txt and (txt is not None) and (txt is not False):
result += ustr(txt)
return result
return str2xml(result)
def text_get(node):
return ''.join([ustr(n.text) for n in node])