oops. fat-finger. Should cornice be only used for standalone apps? regards robert
On Tue, Jan 3, 2012 at 8:55 AM, Robert Forkel <[email protected]> wrote: > i'm trying to use cornice to add an API to an existing pyramid > application, but i'm not sure whether this is an inteded use case. > Right now this is made difficult by things like the registration of a > static view at 'static' in cornice's 'includeme' (because it > overwrites a view my base app already registered). > So should cornice be used only for standa > > On Sat, Dec 24, 2011 at 3:34 AM, Gael Pasgrimaud <[email protected]> wrote: >> On Sat, Dec 24, 2011 at 2:02 AM, Wyatt Baldwin >> <[email protected]> wrote: >>> On Wednesday, December 21, 2011 2:59:01 PM UTC-8, Gael Pasgrimaud wrote: >>>> >>>> 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 >>> >>> >>> Why not just use the built-in @view_config decorator? >> >> Don't know if you have tried to build an api with more than one format >> but when you have 2 or 3 decorators with a lot of parameters per >> method this starts to become a bit... unreadable. >> >> A lot of parameters can be set at the class level or automatically set >> for you if you want to define a RESTFul resource: >> >> - route name - always the same for a resource (two routes in fact: >> collection/element) >> >> - http method - resolved from method name >> >> - a global permission - redefined for each method if needed >> >> - a default renderer - json >> >> - etc. >> >> FYI I've added this implementation and Alexis has added a few docs: >> https://github.com/mozilla-services/cornice/blob/master/docs/source/resources.rst >> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "pylons-discuss" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/pylons-discuss/-/z0zUTwbJnSAJ. >>> >>> 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. >> -- 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.
