[4suite] Bug in (Pretty)Print ?
Uche Ogbuji
uche.ogbuji at fourthought.com
Thu Sep 21 09:50:37 MDT 2000
Nicolas Chauvat wrote:
> File test.xml is a one-liner:
>
> <xsltemplate match="email/headers[substring-after(subject,'address')]"/>
>
> Then try this:
>
> >>> from xml.dom.ext.reader import Sax2
> >>> a = Sax2.FromXmlFile('test.xml')
> >>> Print(a)
> <xsltemplate match='email/headers[substring-after(subject,'address')]'/>
>
> Notice the simple quote that replaced the double quotes ? That makes
> trouble if you then try to re-read the string using Sax2:
[snip]
> I suppose it's (Pretty)Print that has to be fixed.
Absolutely. Ouch! Here's the patch to fix that:
*** Printer.py.old Tue Sep 19 14:24:00 2000
--- Printer.py Thu Sep 21 09:45:25 2000
***************
*** 368,374 ****
if hasattr(node.ownerDocument,'isHtml') and
node.ownerDocument.isHtml() and len(node.childNodes) == 0:
st = ' ' + node.name
else:
! st = " %s='%s'" % (node.name, TranslateCdata(node.value))
self.stream.write(st)
return
--- 368,376 ----
if hasattr(node.ownerDocument,'isHtml') and
node.ownerDocument.isHtml() and len(node.childNodes) == 0:
st = ' ' + node.name
else:
! text = TranslateCdata(node.value)
! text, delimiter = TranslateCdataAttr(text)
! st = " %s=%s%s%s" % (node.name, delimiter, text,
delimiter)
self.stream.write(st)
return
Note we also discovered that re really didn't win the battle with
distutils as we thought we did. It turns out all our files have the
debug code, which slows them down almost two-fold, among other things.
So I think there will be a 4Suite 0.9.0.1 today, incorporating the above
fix and any others that come across our desks today.
Bah!
--
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