quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton" <grah...@dscpl.com.au>
Subject Re: get_session(), req.session, req.form and MODPYTHON-38
Date Mon, 13 Mar 2006 22:30:13 GMT
Grisha wrote ..
> On Mon, 13 Mar 2006, Graham Dumpleton wrote:
> > Thus I want a documented convention that if a handler is going to use
> > util.FieldStorage, that it should before doing so, first check whether
> > an existing instance resides as req.form and use that instead.
> I'm not sure if this is a good example - req.form is something specific
> to 
> the publisher. Rather than perhaps documenting it as you suggest, 
> util.FieldStorage can take it upon itself to create a req.form so that
> subsequent attempts to instantiate it just return req.form. (This is just
> an example, I'm not 100% sure that I having FS do this makes sense - seems
> like a good idea).
> > Similarly, if a handler is going to create a Session object, that it
> > look for an existing instance as req.session and again use that instead.
> OR, the Session module would know to look for a req.session, in which case
> the handlers wouldn't need to worry about it.
> (One thing to watch out for would be that mutliple concurrent sessions
> in the same request is a possibility)

Hmmm, having a look at the code, at some point the check for req.session
got added and I didn't realise or forgot that it had been done.

        # does this code use session?
        session = None
        if "session" in code.co_names:
            if hasattr(req, 'session'):
                session = req.session
                session = Session.Session(req)

It didn't get added for form though, which means that accessing form
arguments from within a PSP page will mean only those in the query
string of the URL will be available as the content of the request has
already been consumed.

Looks like a audit of both:


need to be done to work out what has and hasn't been done related
to this so we know where we are up to.

Looks a bit like when the req.get_session() changes got rolled back that
it got introduced at that point:


Before the req.get_session() change it didn't exist:


I can't remember if this was a conscious decision to check for req.session
based on suggestions or otherwise.


View raw message