[Twisted-Python] Sessions and URLs

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Aug 9 21:29:08 MDT 2003


On Saturday, August 9, 2003, at 11:45 AM, Edmund Dengler wrote:

> So, the code is structured such that a cookie is not available, the 
> normal
> children still get returned. Is this suppose to be how it works? Should
> this be changed so that a flag is available for "force session"? Or 
> should
> a session always be forced (no option)?

Sorry, this should be documented.  You correctly figured out the series 
of steps (more or less) but you missed the annotation of the request 
:-).

SessionWrapper mangles the request, slightly changing the semantics of 
getSession, so that it may return None.  
UsernamePasswordWrapper.getChild begins with

         s = request.getSession()
         if s is None:
             return request.setupSession()

since it currently requires a session in order to operate.  Eventually 
I hope to remove this and have it operate without a session when 
possible.

> Should we have a pattern such as "session-name:cookie" so we can do a
> pattern match for old sessions no longer cached (and force a new 
> session)?

"pattern match"?  No, we just use a dictionary lookup.  SessionWrapper 
will already create a new session when the old one is no longer cached.





More information about the Twisted-Python mailing list