[Twisted-Python] Patch: Passive getSession for twisted.web.server.Request

Glyph Lefkowitz glyph at twistedmatrix.com
Fri May 16 11:14:21 MDT 2003


On Friday, May 16, 2003, at 09:38 AM, Tom 'Korpios' Tobin wrote:

> This patch adds an option to pass a named argument, passive, to 
> twisted.web.server.Request's getSession method.  If passive is true, 
> then getSession will check for the existence of a session or session 
> cookie; it will not, however, drop a session cookie on the client if 
> one does not already exist.  If there is no session, one would expect 
> None from getSession in this case.

The session stuff in twisted.web.server is on its way to being phased 
out anyway.  Have a look at twisted.web.woven.guard - resources wrapped 
with a SessionWrapper will have the semantics of getSession that you 
want; it puts a setupSession method on the request which tells the 
browser to begin negotiating a session.  (Also, this method is 
resilient in the face of cookies being disabled.)





More information about the Twisted-Python mailing list