[Web-SIG] Where do sessions fit in?
Ian Bicking
ianb at colorstudy.com
Wed Aug 25 05:50:00 CEST 2004
Peter Hunt wrote:
> I've realized now how middleware works. Now, I'm wondering where
> sessions would fit in. Would they be a piece of middleware, or an
> extension? If so, what would the interface look like?
There's a good chance the session would be implemented by the
application/framework sitting on top of WSGI, so WSGI wouldn't factor in
at all.
But middleware could implement the session. It would change the
environment dictionary, adding a key (like 'middleware_name.session'),
which would be the session object. The new key would be an "extension"
of sorts (at least, that's the only extension WSGI has). The session
object then looks like, well, whatever the middleware makes it look like.
The advantage of having it in the middleware, is that if several
frameworks agree on an interface for the session object, it can be
created early and then shared between all the applications, even if the
applications otherwise work very differently.
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Web-SIG
mailing list