[Twisted-web] SessionWrapper componentized

Andrea Arcangeli andrea at cpushare.com
Sat Jan 15 17:26:47 MST 2005


On Sat, Jan 15, 2005 at 11:06:14AM +0000, Valentino Volonghi wrote:
> 
> 
> On Sat, 15 Jan 2005 01:21:07 +0100, Andrea Arcangeli <andrea at cpushare.com> wrote:
> >I'd need the SessionWrapper componentized so I can use compy to store
> > global data for the whole site under the sessionwrapper.
> > 
> > Or is there a better way to do it?
> 
> The site already support remembering stuff 'sitewide'
> 
> site = appserver.NevowSite(resource=root)
> site.remember(foo, IFoo)
> guarded = guard.SessionWrapper(site)
> ..
> 
> Now IFoo is remember for all users.
> 
> You can also do:
> page_instance.remember(bar, IBar)
> And now you have a global user cache.
> 
> And so on with more nested contexts

Works fine. Actually I was already using site.remember for two other
things, but they were not web related, so I didn't had the idea I could use to
cache nevow stuff too ;). (the sessionwrapper looked a level of
indirection closer to nevow, but the site is actually much closer since
I reach it with IBar(ctx) (instead of IBar(inevow.ISession(ctx).guard))

So please forget my patch (I already backed it out from my tree too).

Thanks!



More information about the Twisted-web mailing list