[FIX] encoding errors in format method of sxw reports
lp bug: https://launchpad.net/bugs/312393 fixed bzr revid: christophe@cobalt-20081230111334-5bo141numn0ovx25
This commit is contained in:
parent
892c7f1368
commit
65aa0a8f73
|
@ -284,24 +284,21 @@ class rml_parse(object):
|
||||||
oldtag = self.tag
|
oldtag = self.tag
|
||||||
self._node.data = ''
|
self._node.data = ''
|
||||||
node = self._find_parent(self._node, [oldtag])
|
node = self._find_parent(self._node, [oldtag])
|
||||||
|
ns = None
|
||||||
if node:
|
if node:
|
||||||
pp = node.parentNode
|
pp = node.parentNode
|
||||||
ns = node.nextSibling
|
ns = node.nextSibling
|
||||||
pp.removeChild(node)
|
pp.removeChild(node)
|
||||||
else:
|
self._node = pp
|
||||||
pp=self._node
|
|
||||||
self._node = pp
|
lst = tools.ustr(text).split('\n')
|
||||||
lst=''
|
if not (text and 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)):
|
|
||||||
return None
|
return None
|
||||||
nodes = []
|
nodes = []
|
||||||
for i in range(len(lst)):
|
for i in range(len(lst)):
|
||||||
newnode = node.cloneNode(1)
|
newnode = node.cloneNode(1)
|
||||||
newnode.tagName=rml_tag
|
newnode.tagName=rml_tag
|
||||||
newnode.__dict__['childNodes'][0].__dict__['data'] = lst[i].decode('utf8')
|
newnode.childNodes[0].data = lst[i]
|
||||||
if ns:
|
if ns:
|
||||||
pp.insertBefore(newnode, ns)
|
pp.insertBefore(newnode, ns)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue