[4suite] (Pretty)Print / (Pretty)PrintVisitor bug -- proposed fix.

Nicolas Chauvat nico at logilab.com
Sun Sep 24 05:42:58 MDT 2000


All right, I think I squashed that one, please confirm this is the right
fix:

in xml.dom.ext.__init__.PrettyPrint, change the order of the
arguments: encoding is now next to last:

visitor = Printer.PrettyPrintVisitor(stream, indent, width,
                                     preserveElements, encoding, nss_hints)

in xml.dom.ext.Printer, change the prototype of PrettyPrintVisitor to

   def __init__(self, stream, indent, width, plainElements, encoding='UTF-8',
                nsHints=None):
       self.encoding = encoding
       self._indent = indent
       ...

and in the visitAttr() method of PrintVisitor, replace the lines:

        else:
            text = TranslateCdata(node.value)
            text, delimiter = TranslateCdataAttr(text, self.encoding)

with 

	else:
            text = TranslateCdata(node.value, self.encoding)
            text, delimiter = TranslateCdataAttr(text)

(Yes, those same lines that gave us trouble two days ago >;-)

-- 
Nicolas Chauvat

http://www.logilab.com - "Mais o est donc Ornicar ?" - LOGILAB, Paris (France)




More information about the 4suite mailing list