[4suite] (Pretty)Print / (Pretty)PrintVisitor bug -- proposed fix.
Uche Ogbuji
uche.ogbuji at fourthought.com
Sun Sep 24 12:08:47 MDT 2000
Nicolas Chauvat wrote:
>
> 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)
Thanks. I made encoding the second argument for consistency.
> 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 >;-)
All in CVS now. Thanks.
--
Uche Ogbuji Principal Consultant
uche.ogbuji at fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python
More information about the 4suite
mailing list