R: R: [mod_python] session mechanism in 3.1.0a

Manera, Villiam vmanera at manord.com
Thu Oct 30 14:35:46 EST 2003


I tested your code:
def main1(req):
     sess = Session.Session(req)
     sess.save()
     if sess.is_new():
	return "I'm a new session, my id is : " + str(sess.id())
     else:
	return "I'm NOT a new session, my id is :" + str(sess.id())

the first time:
I'm a new session, my id is : 8e7c9abff96d9256ca9159b40cc44249
if I reload the page:
I'm NOT a new session, my id is :8e7c9abff96d9256ca9159b40cc44249

the  mod_python/3.1.0a has a bug: it not reload the module change yuo have
to put
PythonAutoReload on on apache config
o restart apache
Villiam
-----Messaggio originale-----
Da: Olivier Migeon [mailto:olivier at phgroup.com]
Inviato: giovedì 30 ottobre 2003 12.59
A: Manera, Villiam
Cc: mod_python at modpython.org
Oggetto: Re: R: [mod_python] session mechanism in 3.1.0a


Manera, Villiam wrote:

> try this:
> 	sess = Session.Session(req)
> 	sess.save()


sorry. it doesn't change a thing...

as I undestand it :

the first time I load my page in a new session, I call :

sess = Session.Session(req)

this send a cookie to my browser, and I have checked that the cookie is 
actually sent and received.

when i reload the page, i call again :

sess = Session.Session(req)

according to the documentation (and to the code od Session.py, which 
seems straigtforward) mod_python should check that there is a valid 
relevant cookie, and not instanciate a new session.

it seems to me like a cookie-reading problem (or, from my part, a total 
misunderstanding of what a session is).


olivier migeon





More information about the Mod_python mailing list