[mod_python] Session variables

Gustavo Córdova Avila gustavo.cordova at q-voz.com
Wed Apr 14 11:23:01 EST 2004


Ach, this is beautiful, concise, clear, and to the point.

Thankyou so much!!

-gustavo

John Mudd wrote:

>I think the session object is auto loaded (if one already exists).  You
>can request a session for a specific sid but I don't know why.  The sid
>is auto saved in a cookie for you.
>
>	session = Session.Session(req, None, secretKey)
>
>
>If you saved a session before for this same client, and it hasn't
>expired yet. you'll get the same session back.  If it's a mew client or
>te session expired you'll get a new (blank) session.  Use is_new() to
>test.
>
>	if session.is_new():
>	
>
>Once you have a session object you can store stuff in it.  Like a
>dictionary.  You can also set (and later reset) a timeout.
>
>    session['login'] = login
>    session['passwd'] = passwd
>    session['page'] = nextPage
>    session['loginCount'] = loginCount
>
>
>
>And it seems that a "pysid" cookie is auto generated when you save the
>session object.  
>
>	session.save()
>
>
>Pretty cool.  Now if there is just an automatic way to tell if a new
>session is the result of an old session expiring...
>
>John
>
>
>On Thu, 2004-04-01 at 11:58, jakob at simon-gaarde.dk wrote:
>  
>
>>Hello.
>>I can see that you can save and load session values from mod_python 3.1,
>>but unfortunately I don't understand how this works. Could someone
>>elabourate with an example please?
>>
>>Best regards Jakob Simon-Gaarde
>>_______________________________________________
>>Mod_python mailing list
>>Mod_python at modpython.org
>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>    
>>
>
>_______________________________________________
>Mod_python mailing list
>Mod_python at modpython.org
>http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>  
>



More information about the Mod_python mailing list