From 65aa0a8f73ee48a2a51bca918226d5d5128553b9 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 30 Dec 2008 12:13:34 +0100 Subject: [PATCH] [FIX] encoding errors in format method of sxw reports lp bug: https://launchpad.net/bugs/312393 fixed bzr revid: christophe@cobalt-20081230111334-5bo141numn0ovx25 --- bin/report/report_sxw.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 6f46d49d7f6..ee1555dbc0d 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -284,24 +284,21 @@ class rml_parse(object): oldtag = self.tag self._node.data = '' node = self._find_parent(self._node, [oldtag]) + ns = None if node: pp = node.parentNode ns = node.nextSibling pp.removeChild(node) - else: - pp=self._node - self._node = pp - lst='' - if isinstance(text,(str,unicode)): - lst = text.split('\n') -# lst = str(text).split('\n') # This is also acceptable, isn't it? - if lst and (not len(lst)): + self._node = pp + + lst = tools.ustr(text).split('\n') + if not (text and lst): return None nodes = [] for i in range(len(lst)): newnode = node.cloneNode(1) newnode.tagName=rml_tag - newnode.__dict__['childNodes'][0].__dict__['data'] = lst[i].decode('utf8') + newnode.childNodes[0].data = lst[i] if ns: pp.insertBefore(newnode, ns) else: