[mod_python] Session instances can't be stored in req?

StianSøiland stian at soiland.no
Fri Nov 7 11:36:33 EST 2003

Again with 3.1.2b..

I've gone a bit tired of creating the session objects on every page, so
I made a fixuphandler to do the trick. The problem is, Apache hangs for

def fixuphandler(req):
    # req.session = Session(req)
    sezz = Session(req)
    req.blapp = str(id(sezz))
    req.blupp = sezz
    open("/tmp/faentosk", "w")
    return apache.OK

Within index.py:  (result is a html document)

except Exception, e:

Now, if I don't save the session instance (the sezz) - everything works. If I
try to store sezz in req.blupp - everything fails - the apache process hangs,
the file /tmp/faentosk is never created, ie. everything stops at the
previous line.

I've tried making a Dummy class and instanciating it instead, sezz =
Dummy() - and writing out the id in same way, works like a charm, and
the id confirms that it's the same object instanciated within

Any tip?

Stian Søiland               Work toward win-win situation. Win-lose
Trondheim, Norway           is where you win and the other lose.
http://www.soiland.no/      Lose-lose and lose-win are left as an
                            exercise to the reader.  [Limoncelli/Hogan]

More information about the Mod_python mailing list