[mod_python] Bug with document root.

Jim Gallacher jpg at jgassociates.ca
Sun Mar 12 10:48:57 EST 2006


This looks like an old bug related to the use of AddHandler inside the 
location section. It has been fixed in version 3.2.

http://issues.apache.org/jira/browse/MODPYTHON-50

Jim

Wouter van Marle wrote:
> On Sun, 2006-03-12 at 10:13 -0500, Jim Gallacher wrote:
> 
> 
>>Hi Wouter,
>>
>>Which version of mod_python are you using?
> 
> 
> 
> apache2-mod_python-2.0.50_3.1.3-1mdk, Installed from rpm.
> 
> 
> 
>>Could you also provide the 2 different configurations and a snippet of 
>>the code that is causing the problem? Maybe it should be obvious from 
>>the traceback, but after reading the first 3 lines this morning my brain 
>>seized. ;)
> 
> 
> 
> The difference is in the definition of DocumentRoot in either the
> httpd2.conf or the Vhosts file. I've now commented out the Vhost
> completely, and set DocumentRoot in httpd2.conf. For the rest no
> changes.
> 
> The Vhost definition:
> <VirtualHost jaimys>
>        ServerAdmin wouter at jaimysoutdoorkitchens.com
>        ServerName www.jaimysoutdoorkitchens.com
>        ServerAlias jaimys
>        DocumentRoot /var/www/html/jaimys/
>        <Location />
>                AddHandler mod_python .py
>                PythonDebug On
>        </Location>
>        PythonHandler mod_python.publisher
>        ErrorLog /var/log/jaimys-error.log
> </VirtualHost>
> 
> Wouter.
> 
> 
> 
>>Jim
>>
>>
>>Wouter van Marle wrote:
>>
>>>Hi all,
>>>
>>>I think I ran into a bug of mod_python, regarding sessions. If I define
>>>my site (and document root) in the Vhosts section, I get the below
>>>error. If it is defined in the main configuration of apache (single
>>>site) then there is no problem. Very strange, as the Vhosts idea used to
>>>work (well... that is... Apache recognises and uses only the first
>>>definition, so not all goes that great). Running Mandrake 10.1.
>>>
>>>Wouter.
>>>
>>>
>>>Mod_python error: "PythonHandler mod_python.publisher"
>>>
>>>Traceback (most recent call last):
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
>>>299, in HandlerDispatch
>>>    result = object(req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line
>>>136, in handler
>>>    result = util.apply_fs_data(object, req.form, req=req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/util.py", line 361,
>>>in apply_fs_data
>>>    return object(**args)
>>>
>>>  File "/var/www/html/jaimys/python/main.py", line 38, in home
>>>    req.session = util.getSession(req)
>>>
>>>  File "/var/www/html/jaimys/python/util.py", line 80, in getSession
>>>    sess = Session.Session(req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>389, in Session
>>>    timeout=timeout, lock=lock)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>294, in __init__
>>>    timeout=timeout, lock=lock)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>132, in __init__
>>>    Cookie.add_cookie(self._req, self.make_cookie())
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>160, in make_cookie
>>>    c.path = dirpath[len(docroot):]
>>>
>>>TypeError: unsubscriptable objectMod_python error: "PythonHandler
>>>mod_python.publisher"
>>>
>>>Traceback (most recent call last):
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
>>>299, in HandlerDispatch
>>>    result = object(req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line
>>>136, in handler
>>>    result = util.apply_fs_data(object, req.form, req=req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/util.py", line 361,
>>>in apply_fs_data
>>>    return object(**args)
>>>
>>>  File "/var/www/html/jaimys/python/main.py", line 38, in home
>>>    req.session = util.getSession(req)
>>>
>>>  File "/var/www/html/jaimys/python/util.py", line 80, in getSession
>>>    sess = Session.Session(req)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>389, in Session
>>>    timeout=timeout, lock=lock)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>294, in __init__
>>>    timeout=timeout, lock=lock)
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>132, in __init__
>>>    Cookie.add_cookie(self._req, self.make_cookie())
>>>
>>>  File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line
>>>160, in make_cookie
>>>    c.path = dirpath[len(docroot):]
>>>
>>>TypeError: unsubscriptable object
>>>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>_______________________________________________
>>>Mod_python mailing list
>>>Mod_python at modpython.org
>>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list