[Twisted-web] Get access to Avatar from Resource object?

Duncan McGreggor duncan.mcgreggor at gmail.com
Thu Feb 23 16:44:39 EST 2012


Just to throw some two-cents in:

What JP described is essentially what I did when I consulted for
IncrediblePear back in 2008. I built an async REST API service with
Twisted (and cred powering a fairly elaborate permissions system). The
customer was PBS.org. It's what underlies their TV scheduling on their
main site and all the affiliate stations that make use of the main
site's scheduling API. (lots of memcached... they are a HUGE site in
reqs/s).

Twisted is a good choice :-) Best of luck!

d

On Thu, Feb 23, 2012 at 4:09 PM, Jacek Furmankiewicz <jacek99 at gmail.com> wrote:
> Ah, I think I get it.
>
> So Avatar = root resource that this user can access, correct?
>
> That is quite flexible actually. It's like you can serve a totally different
> application (i.e. resource) to the user depending on their
> credentials/roles/etc.
>
> I will wrap my head around it a bit more in the coming weeks and see how I
> can add the functionality I want (able to add fine grained security per REST
> method on a resource)
> while working in spirit with the twisted.web.guard approach.
>
> Thanks to everyone for your help
>
> Jacek
>
> On Thu, Feb 23, 2012 at 2:09 PM, Jerry Westrick <jerry at westrick.com> wrote:
>>
>> Okay, No one asked me, so I have the right to show off my ignorance :-)
>>
>>
>>
>> But it sounds to me like you should build something called "secureRealm",
>> which
>>
>> which does security checks before requesting a resource from the IRealm?
>>
>>
>> Jerry
>>
>>
>>
>>
>> On February 23, 2012 at 1:33 PM Glyph Lefkowitz <glyph at twistedmatrix.com>
>> wrote:
>>
>> >
>> > On Feb 23, 2012, at 12:37 PM, Jacek Furmankiewicz wrote:
>> >
>> > > D'oh!
>> > > That's what happens when you copy code from the web, sorry :-(
>> > >
>> > > So just a follow up to my other question: how do I add my child
>> > > resources?
>> >
>> > However you like!  I'm not sure what you're asking here; TestRealm
>> > returns a resource object, to which you may add child resources in any
>> > manner you see fit.  Usually this is done simply by having methods on that
>> > object (getChild) which can synthesize appropriate child resources when
>> > asked for them, but I wouldn't call that a "best practice" or anything; it's
>> > just something that makes sense a lot of the time.
>> >
>> > > Does my TestRealm need to extend Resource? Is that the recommended
>> > > approach?
>> >
>> > No.  TestRealm should *return* IResource providers (when asked for them
>> > - that's what the 'interfaces' argument is for).  It itself should just
>> > provide IRealm, and it definitely shouldn't inherit from anything else.
>> >
>> > -glyph
>> > _______________________________________________
>> > Twisted-web mailing list
>> > Twisted-web at twistedmatrix.com
>> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>>
>> _______________________________________________
>> Twisted-web mailing list
>> Twisted-web at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>>
>
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>



More information about the Twisted-web mailing list