[mod_python] mod_python, best practices

Scott Sanders sanders at apache.org
Wed Nov 24 12:03:07 EST 2004


In session handling, what is wrong with just using 
Session.Session(req)?  This will get the existing session, if it 
exists.  Then you could just add the session.isnew stuff in a helper 
method.  I would say that the only reason for this is if you aren't 
allowing cookies, and you are doing your own style of url-rewriting ala 
java servlets.

The only gotcha in this:  If you end up redirecting for login or 
something similar, the cookie won't get set, so the session won't get 
picked up.

The other thing I wanted to note with the sessions is that it is not 
necessary to unlock the session, UNLESS you are going to do an internal 
redirect.

Or so go my experiences on Mac OS X and Windows XP/ Apache 2.0.49|50, 
mod_python 3.1.3, python 2.3.4

Scott Sanders

On Nov 24, 2004, at 1:35 AM, Rune Hansen wrote:

> Hi,
> I've written a rather long and winding document which I've called 
> "mod_python, best practices".
>
> A better name would be "mod_python, assumptions made on shaky ground - 
> kept in a light tone to mask my inherent fear of making a complete 
> fool of my self." Obviously, that title is to long.
>
> Anyway, the document can be found here http://www.scanmine.com/mp/
>
> I'd really like thoughts, comments and corrections... keep your smirks 
> and laughs to your self :)
>
> As you read the document it will become apparent that english is not 
> my native tongue, feel free to comment on that too.
>
> regards
>
> /rune
>
> _______________________________________________
> 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