On Mon, Oct 20, 2008 at 06:43:53PM +0200, Matthias Klose wrote:
> Since some time a subset of python-xml is included in the standard
> python library, while the python-xml package did not see any updates
> for years. It is time to drop it from the distribution. Update
> scenarios:
I've investigated a bit the issue for MoinMoin, here are some info in
the hope they help.
- RSS generation is not an issue, it works properly even without
python-xml (no need even for an alternative library)
- docbook generation on the contrary is an issue. It actually relies
on python-4suite, but apparently it is no longer compatible with the
4suite we currently have in unstable. Also, it mixes the 4suite need
with some modules that use to be available in python-xml and which
are not emulated by legacy XML support in the python standard
library.
I've a partial patch that fixes all module import issues and which I
attach. However, it still does not work because it seems that the
new 4suite requires all string data encoded as "unicode" data types
and not "str". So there is a need to chase down all strings passed
to the 4suite pretty printer to convert them to unicode :-/
FWIW, I've also checked 1.9~beta3 release of MoinMoin, docbook support
is still broken wrt this issue also there.
Feedback from the maintainer would be good to understand whether he is
in touch with upstream about this or not.
Cheers.
--
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
z...@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..| . |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime
--- MoinMoin/formatter/text_docbook.py 2009-06-09 21:49:50.000000000 +0200
+++ /usr/share/pyshared/MoinMoin/formatter/text_docbook.py 2009-09-06 15:02:03.000000000 +0200
@@ -12,8 +12,11 @@
import os
from xml.dom import getDOMImplementation
-from xml.dom.ext.reader import Sax
-from xml.dom.ext import Node
+try:
+ from Ft.Xml.Domlette import NonvalidatingReader as Reader
+except ImportError:
+ raise InternalError("You need to install 4suite to use the DocBook formatter.")
+from xml.dom import Node
from MoinMoin.formatter import FormatterBase
from MoinMoin import wikiutil
@@ -28,10 +31,7 @@
class InternalError(CompositeError):
pass
-try:
- dom = getDOMImplementation("4DOM")
-except ImportError:
- raise InternalError("You need to install 4suite to use the DocBook formatter.")
+dom = getDOMImplementation()
class Formatter(FormatterBase):
@@ -73,7 +73,7 @@
def startDocument(self, pagename):
self.doc = dom.createDocument(None, self.doctype, dom.createDocumentType(
- self.doctype, "-//OASIS//DTD DocBook XML V4.4//EN",
+ unicode(self.doctype), "-//OASIS//DTD DocBook XML V4.4//EN",
"http://www.docbook.org/xml/4.4/docbookx.dtd"))
self.title = pagename
@@ -101,7 +101,7 @@
return ""
def endDocument(self):
- from xml.dom.ext import PrettyPrint, Print
+ from Ft.Xml.Domlette import PrettyPrint, Print
import StringIO
f = StringIO.StringIO()
@@ -614,7 +614,7 @@
self.paragraph(0)
text = FormatterBase.macro(self, macro_obj, name, args)
if text.strip():
- self._copyExternalNodes(Sax.FromXml(text).documentElement.childNodes, exclude=excludes)
+ self._copyExternalNodes(Reader.parseString(text).documentElement.childNodes, exclude=excludes)
if was_in_para:
self.paragraph(1)
@@ -623,7 +623,7 @@
if text:
from xml.parsers.expat import ExpatError
try:
- xml_dom = Sax.FromXml(text).documentElement.childNodes
+ xml_dom = Reader.parseString(text).documentElement.childNodes
self._copyExternalNodes(xml_dom, exclude=excludes)
except ExpatError:
self._emitComment("The macro %s caused an error and should be blacklisted. It returned the data '%s' which caused the docbook-formatter to choke. Please file a bug." % (name, text))