On Wed, Dec 21, 2011 at 11:18 PM, Tarek Ziadé <[email protected]> wrote:
>
>
> On Wed, Dec 21, 2011 at 11:00 PM, Gael Pasgrimaud <[email protected]> wrote:
>>
>> Hi,
>>
>> On Wed, Dec 21, 2011 at 11:24 AM, Tarek Ziadé <[email protected]>
>> wrote:
>> > We'd love feedback & new contributors !
>>
>> Looks like a clever way to build some APIs. I have a project where I
>> may switch to cornice. But I have a few questions.
>>
>> First, are you planning to add a support for class based views ? I'd
>> like to define my services like this:
>>
>> @cornice.service(path='/users')
>> class User(object):
>>
>>    def __init__(self, request):
>>        self.request = request
>>
>>    def get(self):
>>        """do get"""
>>
>>
>> Where get / post / put / delete and index (to get a listing) routes
>> will be automatically added if they are implemented. This is something
>> that missing from Pylons the framework (at least for me).
>>
>
> I have never thought of that but why not ? using the method names instead of
> explicit decorator seems neat.
>
> The only caveat I see is that we actually pass options to decorators, like
> particular renderers, permissions, validators etc.
>
> So I wonder where we'd put them in the case of a class, for each service,
>

Here is a proof of concept (can be improved)
http://friendpaste.com/4MnSHaRPkNU9RCtHkd4ggU

>
>
>>
>> Does cornice support sub resources ? (eg: with a path like
>> /users/{id}/pages/)
>
>
> I don't know what sub resources are. If it's just jokers like {id} in the
> path then yes, you can and
> you will find them back in request.matchdict
>
>
>
>>
>> And the last one. Can we use the pyramid authentication/authorisation
>> stuff with cornice ?
>
>
> yes. you can define permissions, see for example:
>
> https://github.com/mozilla-services/demoapp/blob/master/demoapp/views.py
>
> and acl factories, see
>
> https://github.com/mozilla-services/cornice/blob/master/cornice/service.py#L98
>
> (sorry the latter is not really documented)
>
>

Nice. I guess I'll try to switch one day (time is always missing..)

>
>>
>>
>>
>> >
>> > Cheers
>> > Tarek
>> >
>> > --
>> > Tarek Ziadé | http://ziade.org
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "pylons-discuss" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group at
>> > http://groups.google.com/group/pylons-discuss?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/pylons-discuss?hl=en.
>>
>
>
>
> --
> Tarek Ziadé | http://ziade.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to