[XML-SIG] pyxml fails in mod_python-2.7.8

Tobias Hintze th@hbsn.de
Thu, 12 Dec 2002 02:14:12 +0100

i just updated my PyXML installation to 0.8.1.

i'm using apache 1.3.27 with mod_python-2.7.8.

within mod_python i can't get a simple hello-world to work which works
fine outside mod_python and worked fine with prior versions of PyXML.

AddHandler python-program .py
PythonHandler handler::Handler.dispatch
PythonDebug On

from xml.dom.ext.reader import Sax2
from mod_python import apache

class Handler:
        def __init__(self, req):
                self.xml_reader = Sax2.Reader()

        def dispatch(self, req):
                req.content_type = "text/plain"

                req.write("hello world\n\n")

                req.write("handler %s\n" % str(self.xml_reader.handler))
                req.write("parser %s\n" % str(self.xml_reader.parser))
                req.write("sys.path %s\n" % str(sys.path))

                doc = self.xml_reader.fromString("<foo><bar>spam</bar></foo>")
                req.write("\nparsed document: %s\n" % str(doc))

                return apache.OK

output i get from mod_python:
hello world

handler <xml.dom.ext.reader.Sax2.XmlDomGenerator instance at 0x867ba5c>
parser <xml.sax.expatreader.ExpatParser instance at 0x867a93c>
sys.path ['/opt/w3/default/xmltest/', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site-packages']

parsed document: None

i get a NoneObject from fromString() where i get a <XML Document at 81f0f24> 
outside mod_python.

any hints how to use PyXML-0.8.1 within mod_python-2.7.8?

Tobias Hintze http://hbs-solutions.de
HBS solutions GbR - Network & Information Systems