[mod_python] please help...

sa sahrens at uv.ruhr-uni-bochum.de
Fri Nov 24 18:09:04 EST 2000


Hi folks,
I got the script which runs perfect on my linuxbox as long as it´s not
running inside mod_python. Below I show you the mod_python version that
is producing the error code you can see on the bottom of this mail. As I
am new to mod_python but can still remember such strange effects when
playing with mod_perl for the first time some years ago I think it´s
time for some guru´s advice
Maybe I didn´t get any global restrictions (like always using the strict
pragma under mod_perl) so far. Please give some hint where to look
further

    thanks a lot

            Sebastian

------the script------

from mod_python import apache
import string, os, re
import xml.dom.ext
from xml.xslt import XsltException
from xml.xslt.Processor import Processor


sheet = """
        <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">

          <xsl:template match="main">
            <html><head>ein test</head><body>
                    <hr/>
                    <b><xsl:value-of select="/main/test"/></b>
                    <em><xsl:value-of select="/main/testBody"/></em>
            </body></html>
          </xsl:template>

        <xsl:apply-templates/>
        </xsl:stylesheet>
        """

def handler(req):
    req.content_type = "text/plain"
    req.send_http_header()
    the_req_file = req.the_request
    a = string.split(the_req_file, " ")
    tmp_file = string.split(a[1], "?")
    file_name = tmp_file[1]
    path_prefix = "/var/www"
    path = path_prefix+file_name
    raw_data = open(path).read()

    processor = xml.xslt.Processor.Processor()
    processor.appendStylesheetString(sheet)
    result = processor.runString(raw_data, ignorePis=1)
    req.write(result)
    return apache.OK


------- the error ---------


> Mod_python error: "PythonHandler xmlhandler"
>
> Traceback (innermost last):
>
>   File "/usr/lib/python1.5/site-packages/mod_python/apache.py", line 175, in Dispatch
>     module = import_module(module_name, _req)
>
>   File "/usr/lib/python1.5/site-packages/mod_python/apache.py", line 316, in import_module
>     module = __import__(module_name)
>
>   File "/var/www/xml/xmlhandler.py", line 3, in ?
>     import xml.dom.ext
>
>   File "/usr/lib/python1.5/site-packages/xml/dom/__init__.py", line 41, in ?
>     from xml.dom.html import HTMLDOMImplementation
>
>   File "/usr/lib/python1.5/site-packages/xml/dom/html/__init__.py", line 281, in ?
>     g_numCharEntityPattern = re.compile('?(\d+);')
>
>   File "/usr/lib/python1.5/re.py", line 79, in compile
>     code=pcre_compile(pattern, flags, groupindex)
>
> pcre.error: ('unmatched parentheses', 208)
>





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20001124/a648c98d/attachment-0003.htm


More information about the Mod_python mailing list