[mod_python] mod_python Session problem

Catalin Constantin catalin at bounce-software.com
Sun Jan 25 20:43:13 EST 2004


SetHandler mod_python
AddHandler python-program .py
PythonHandler mod_python.publisher
PythonDebug On

index.py file:

import os
from mod_python import apache, Session, psp

def index(req):
        return "Hello"

after the Session.Session(req) call
the script hangs.

i've tryed to see where it hangs and here is what i've found:
insise Session(req, sid=0, secret=None, timeout=0): (Session.py)
the DbmSession is selected
return DbmSession(req, sid=sid, secret=secret,

In the DbmSession constructor __init__ there is a call to
The session is new (never created before) so it reaches the part
with _new...
Check below.

        if self._new:
            # make a new session
            if self._sid: self.unlock() # unlock old sid
            self._sid = _new_sid(self._req)

            # here it hangs
            self.lock()                 # lock new sid

            Cookie.add_cookie(self._req, self.make_cookie())
            self._created = time.time()
            if timeout:
                self._timeout = timeout
                self._timeout = DFT_TIMEOUT

Is the Sesison handler working ?
Am i doing something wrong ?

Thank you !

Catalin Constantin
Bounce Software

More information about the Mod_python mailing list