[mod_python] Session.Session(req) not finding saved session

Will Gray graywh at gmail.com
Tue May 1 12:28:33 EDT 2007


I'm running Apache 2.2.3 and Mod_Python 3.2.10.  I'm using
Mod_Python.Publisher to handle requests.  When I upgraded Apache from 2.0 to
2.2 (and Mod_Python, accordingly), I was no longer able to get the saved
session when a visitor changes pages.  Instead, it creates and returns a new
session.  I was able to verify that the session was still available and
being saved correctly with the data inside.  Here is a sample of what my
views are doing:

def login(req):
    sess = Session.Session(req)
    userid = sess.get('uid', None)
    if userid:
        util.redirect(req, 'view')
    ##get username and password from req.form and authenticate against db##
    if uid:
        sess['uid'] = uid
        sess.save()
        util.redirect(req, 'view')
    else:
        ##display the login form##

def view(req):
    sess = Session.Session(req) # creates a new session instead of finding
the old one
    userid = sess.get('uid', None)
    if not userid:
        util.redirect(req, 'login')
    ##do some db queries and display the page##

-- 
Will Gray
Nashville, TN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070501/84e242df/attachment.html


More information about the Mod_python mailing list