[mod_python] The Session problem with mod_python3.2.7

Graham Dumpleton grahamd at dscpl.com.au
Tue Feb 21 05:45:11 EST 2006


On 21/02/2006, at 9:25 PM, Gavin wrote:

>> On 21/02/2006, at 5:41 PM, Gavin wrote:
>>
>>> hello Graham
>>>
>>> Thank you!
>>> My configuration is as following:
>>>
>>> <Directory "/data/HTTPD/htdocs/FeedBack">
>>>
>>>   AddHandler mod_python  .m
>>
>> Do you really mean ".m"? Don't you mean ".psp, how else can you use
>> "sid.psp"
>> as file name?
>>
> Right. I use sid.m.

In the URL, or for the file? Its a bit confusing. Is there are reason  
you want
to use ".m" extension?

Anyway, when I take the PSP code you posted and which you referred to
as "sid.psp" and put in a directory with .htaccess file of:

AddHandler mod_python .psp
PythonHandler mod_python.psp
PythonDebug On

If I access it as sid.psp in URL, the code works as expected.

>>>   PythonHandler mod_python.psp
>>>   #PythonHandler mod_python.publisher
>>>   PythonPath "['/data/HTTPD/py_api']+['/data/HTTPD/htdocs/FeedBack']
>>> +sys.path"
>>>   PythonDebug Off
>>>   Options Indexes FollowSymLinks
>>>   Order deny,allow
>>>   Allow from all
>>>
>>> </Directory>
>>>
>>> I don't use PythonOption to override the either "session_dbm" or
>>> "session_directory"
>>>
>>
>> All I can suggest then is to look for the file:
>>
>>   /tmp/mp_sess.dbm.db
>>
>> or something named similarly. I don't think it is meant to have extra
>> ".db" extension
>> but on my Mac there is one for some reason.
>>
>>
> Cann't found any file like mp* under /tmp

All I can suggest then is to modify lib/python/mod_python/Session.py in
mod_python source code and add in some debug statements to see what
session database name is being set to.

class DbmSession(BaseSession):

     def __init__(self, req, dbm=None, sid=0, secret=None,  
dbmtype=anydbm,
                  timeout=0, lock=1):

         if not dbm:
             opts = req.get_options()
             if opts.has_key("session_dbm"):
                 dbm = opts["session_dbm"]
             else:
                 dbm = os.path.join(opts.get('session_directory',  
tempdir), 'mp_sess.dbm')

         self._dbmfile = dbm
         self._dbmtype = dbmtype

         # XXX DEBUG

         apache.log_error("dbmfile=%s"%self._dbmfile)

Reinstall mod_python and restart Apache.

Then when running test, look in Apache error_log to see where it  
thinks it is getting
put. See if file exists if not in /tmp.

Graham


More information about the Mod_python mailing list