rst2odt_prepstyles.py currently uses lxml to parse, modify and write XML. The attached patch makes it use ElementTree instead, which has been part of Python's standard library since 2.5.
With [bugs:#255] solved and changes to the source (to make it Py3k-conform), is there an advantage of using elementtree that makes it worth updating, testing, and applying the patch ?
Here is a revised version of this patch, which also adds Python 3 compatibility (by using correct
Except:statements andsys.stderr.write).Dear Docutils developers, can you please comment on this ticket? (And probably other ones in "patches" group).
i am trying.
please (leave the patch here) and move discussion to
https://sourceforge.net/p/docutils/bugs/255/
With [bugs:#255] solved and changes to the source (to make it Py3k-conform), is there an advantage of using elementtree that makes it worth updating, testing, and applying the patch ?
Related
Bugs:
#255lxml is not part of standard library, while xml.etree is. So we are adding a dependency on a 3rdparty project for no good reason.
I am attaching a version of this patch which applies cleanly to master branch of git mirror.
I see. Thanks for the clarification.
When I try to use the patched script on a copy of
docutils/writers/odf_odt/styles.odt, I get an error:BTW, the non-patched version fails with:
First error can be fixed by replacing
el.attrib.keys()withlist(el.attrib). Second error can be fixed by changing argument of os.fdopen fromwtowb.I am attaching an updated version of the patch. Although you may want to commit
wtowbchange as a separate revision, for ease of backporting.Applied in [r9365].
(Without the handling of Python <2.5 as we no longer support Python 2.)
Thank you for the patch.
Related
Commit: [r9365]
Fixed in Docutils 0.20
Thanks for the patch and explanations.