[mod_python] Session Management, Straight Answer?

.: smilelover :. smilelover at centrum.cz
Thu May 18 05:17:18 EDT 2006


Thanks for comments!
Yes, yes, the timeout is OK. The thing I sent was purely experimental, just to learn sessions and to check out how timeout works.

Thanks also for info about PSP.

Robust :) ...yes, it might not be. just experimenting so far..

So where exactly do you create sessions? Do you have any special handler set in htaccess for that and point to it when needed?

Dan
______________________________________________________________
> Od: grahamd at dscpl.com.au
> Komu:  ".: smilelover :." <smilelover at centrum.cz>
> CC:  <mod_python at modpython.org>
> Datum: 17.05.2006 12:38
> Předmět: Re: [mod_python] Session Management, Straight Answer?
>
>  I'm not sure you actually need the load() and delete() calls. The load ()
> is
> called from the constructor and the delete() from invalidate().
> 
> The session timeout is specified as seconds. Do you really mean to  have
> it
> be 30 seconds? The default timeout is 30 minutes.
> 
> If you are using mod_python 3.2.7 or later and are using PSP in 
> conjunction
> with publisher, set req.session to your session object and PSP will 
> automatically
> use it rather than create its own when "session" attribute is  accessed in
> a page.
> That way you can still access it from the PSP page.
> 
> At a quick glance, am bit concerned about whether it is is robust as  a
> whole,
> but don't have access to my own code at present and don't have time to
> play with your code.
> 
> FWIW, I don't do my session creation management from the content handler
> but in an earlier phase with the session object being left in 
> req.session. This
> way the session management will work no matter whether you are using PSP
> pages, publisher, a mix of these or even custom handlers. Thus the 
> session
> management becomes a reusable unit in itself. Can't remember though 
> whether
> I was dependent on features specifically in mod_python 3.3 though.
> 
> Graham
> 
> 
> On 17/05/2006, at 6:14 PM, .: smilelover :. wrote:
> 
> > I also struggled a lot to understand the sessions stuff and now I  > use
> sessions this way:
> >
> > in index I enter login and pass in a form and send it to  > check_login,
> which checks the login data and if correct, creates a  > session object,
> fills it with the data I need it to bear, sets  > timeout and saves it. On
> the check_login page there is a link that  > points to  "section" (some
> imaginary section, as if in some admin  > pass-protected area). In the
> section, I create another session  > object, but the first thing I do with
> it is sess.load(), which  > loads the data of the previously saved session.
> And thats it.
> >
> > I attached the code and templates (I use publisher) + .htaccess  > file.
> It should work for you.
> > With regular PSP it's probably different, as Graham wrote.
> >
> > This is the way I use it and it is quite possible it is some  >
> deprecated way. I don't know :) If anyone of you knows there are  > some
> serious mistakes in the way I use sessions, don't hesitate and  > post it
> here.
> > Thx.
> >
> > Dan
> > ______________________________________________________________
> >> Od: max_lynch at sbcglobal.net
> >> Komu:  mod_python at modpython.org
> >> CC:
> >> Datum: 16.05.2006 06:08
> >> Předmět: [mod_python] Session Management, Straight Answer?
> >>
> >>  I have looked at many of the session management posts on the  >> list,
> but I
> >> am looking for a straightforward answer on how to make session data
> >> persist through different pages.  I have seen examples on using
> >> cookies/etc., but I would like a formal answer as it seems many  >>
> people are
> >> also stuck on this (I might post my experiences with mod_python on  >>
> a site
> >> as first-hand documentation, so that could help).  Also, I am  >> using
> psp,
> >> not the publisher stuff.  Love mod_python so far though, just a  >>
> little
> >> stuck!
> >>
> >> Thanks,
> >> Max Lynch
> >>
> >> _______________________________________________
> >> Mod_python mailing list
> >> Mod_python at modpython.org
> >> http://mailman.modpython.org/mailman/listinfo/mod_python
> >>
> >>
> >
> > <session.zip>
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> 
> </session.zip>



More information about the Mod_python mailing list