[Twisted-web] Get identity of previously-authenticated user

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Apr 21 20:13:15 EDT 2011


On Apr 21, 2011, at 11:12 AM, Mike Pelletier wrote:

> The only opportunity I have to bind a user identity/object to a
> request is by constructing and throwing away a new Resource tree for
> each request in requestAvatar.  I decided that was probably not what I
> was meant to do.  Instead, I have done something that turns out to
> smell very bad to solve this problem.  What was the correct solution?

Resources can be extremely lightweight objects.  If your actual resource tree is heavyweight (containing lots of data, shared caches, etc) you can trivially build an overlay resource tree that just remembers the user object and binds it to the underlying tree.

So the main question is: why did you decide that this is not what you were meant to do?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20110421/5a842a2c/attachment.htm 


More information about the Twisted-web mailing list