Blob Blame History Raw
diff -up docutils-0.10/docutils/writers/docutils_xml.py.bak docutils-0.10/docutils/writers/docutils_xml.py
--- docutils-0.10/docutils/writers/docutils_xml.py.bak	2012-07-30 20:57:20.000000000 -0700
+++ docutils-0.10/docutils/writers/docutils_xml.py	2012-08-14 07:51:20.389219183 -0700
@@ -11,6 +11,19 @@ http://docutils.sourceforge.net/docs/ref
 __docformat__ = 'reStructuredText'
 
 import sys
+
+# Work around broken PyXML and obsolete python stdlib behaviour (The
+# stdlib replaces its own xml module with the unmaintained PyXML if PyXML
+# is installed.) Reverse the order in which xml module and submodules are
+# searched to import stdlib modules if they exist and PyXML modules if they
+# do not exist in the stdlib.
+#
+# See http://sourceforge.net/tracker/index.php?func=detail&aid=3552403&group_id=38414&atid=422030
+# and http://lists.fedoraproject.org/pipermail/python-devel/2012-July/000406.html
+import xml
+if "_xmlplus" in xml.__path__[0]: # PyXML sub-module
+    xml.__path__.reverse() # If both are available, prefer stdlib over PyXML
+
 import xml.sax.saxutils
 from StringIO import StringIO