[Twisted-web] Remembering things in context from a Realm
Donovan Preston
dp at ulaluma.com
Tue Sep 28 07:48:05 MDT 2004
On Sep 28, 2004, at 12:41 AM, Alex Levy wrote:
> I have a Realm class that does something akin to the following:
>
> class MyRealm:
> def requestAvatar(self, id, mind, *interfaces):
> if IResource is in interfaces:
> user = figureOutWhoTheUserIs(id)
> resource = getResourceForUser(user)
> resource.remember(user, ICurrentUser)
> return (IResource, resource, lambda:None)
>
> ...and this doesn't seem to be working with the ubiquitous context.
> _Should_
> it work, or do I need a new way to do something like this?
>
> Help is appreciated; I'm trying hard to get back in the loop. :/
You are going to have to put user as an attribute on resource, then
remember it in the context in an overridden locateChild.
dp
More information about the Twisted-web
mailing list