[mod_python] bug/misfeature in publisher/mod_python

Damjan gdamjan at mail.net.mk
Tue Dec 3 16:12:44 EST 2002


My setup:
 apache 2.0.43, mod_python 3.0.1, python 2.2.1

httpd.conf:
<Directory /home/www/htdocs> # The root of the web server
...
    SetHandler python-program
    PythonHandler mod_python.publisher | .py
    PythonDebug On
</Directory>
...

I expect this setup to handle all files ending in ".py" through
the publisher handler.

I have the script "hello.py" from the mod_python manual in the root of the
web-server. Trying to get "http://127.1/hello.py/say" mod_python
throws an exception (traceback atached).

The exception is: "ImportError: No module named py"

I've foloved the problem to the publisher handler, line 139. 
When publisher tries to strip the suffixes, it gets them by
calling "req.get_addhandler_exts()". Obviosly in my case this
call return None (I dont have the AddHandler directive). So
publsiher doesn't strip anything, thus trying to import the
module "py" (which is the extension of the script).

The solution for this problem would be for get_addhandler_exts()
alsa to return the extensions as specified in the 
"PythonHandler ... | .ext" directive.



-- 
Damjan Georgievski
-------------- next part --------------

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 335, in HandlerDispatch
    result = object(req)

  File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 149, in handler
    module = apache.import_module(module_name, req.get_config(), [path])

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 499, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named py


More information about the Mod_python mailing list