-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas Jung wrote:
--On 24. März 2006 11:07:06 -0500 Jim Fulton <jim@zope.com> wrote:
- it was broken multiple times in the past, it still has problems
How so?
The import functionality seem to be broken since at least Zope 2.7.
I created a DTML method exported it and _tried_ to reimport it.
Zope 2.7 throws a BadPickleGet, 12 exception,
I just exported the stock 'standard_error_message' as XML and re-imported it successfully in a brand new Zope-2_7-branch instance.
Zope 2.8 throws> BadPickleGet, 13
Likewise, my import succeeded in a Zope-2_8-instance, both with the XML file exported from 2.7 and with one created from 2.8.
Zope 2.9 raises the described UnicodeDecodeError.
My Zope-2_9-branch instance was successfully able to import the XML file from 2.7, but raises a UnicodeDecode error on the file it produces, as well as the one created from 2.8. The stack trace here makes it seem as though Python 2.4.2's expat parser is at fault: it is introducing non-ASCII characters into the stream where none exist in the source: (Pdb) u /home/tseaver/projects/Zope-CVS/Zope-2_9-branch/lib/python/OFS/XMLExportImport.py(114)importXML() - -> r=p.Parse(data) (Pdb) print [x for x in data if ord(x) > 127] [] (Pdb) d
/home/tseaver/projects/Zope-CVS/Python-2.4.3c1/Modules/pyexpat.c(639)EndElement() - -> ("(N)", string_intern(self, name))) (Pdb) d
/home/tseaver/projects/Zope-CVS/Zope-2_9-branch/lib/python/Shared/DC/xml/xyap.py(58)unknown_endtag() - -> top = end[tag](self, tag, top) (Pdb) print [type(x) for x in top] [<type 'unicode'>, <type 'dict'>, <type 'unicode'>, <type 'str'>] (Pdb) print [x for x in top[-1] if ord(x) > 127] ['\xcb'] (Pdb) print [chr(ord(x)) for x in top[-1][10:25]] ['U', '\x03', 'r', 'a', 'w', 'T', '\xcb', '\x04', '\x00', '\x00', '<', 'd', 't', 'm', 'l'] That output seems to me to indicate that the start of the CDATA section is the problem.
I don't expect that the import functionality works for even more complex objects. So I consider the whole functionality as totally broken. The generated XML might be useful to perform any processing outside Zope but using it for re-importing it into another Zope systems definitely does _not_ work. So if the functionality should remain in Zope then it should be fixed for Zope 2.10 lately.
I've just tried again, running with Python 2.4.3c1, because several of the changelog entries for the release suggest that unicode / encoding / expat stuff may have been fixed: the decode error is still present. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEJZsA+gerLs4ltQ4RArirAKC+a8k1GBTrujZ2uu5hygxnkSk9HACeLiAK n+8RTUlzAnsdBAkTDQ730mk= =6CcM -----END PGP SIGNATURE-----