On Fri, Aug 28, 2015 at 6:22 PM, Mike Orr <[email protected]> wrote: > On Fri, Aug 28, 2015 at 3:01 AM, Petr Blahos <[email protected]> wrote: > The advantage of doing individual-record queries ("/customers/137") is > that I can properly raise KeyError if the record doesn't exist.
Another advantage is I can have object-related methods in the resource. I don't make the ORM record the resource itself because somebody said that leads to problems; instead I attach it to the resource. This seems to be the only way to actually put something useful into the resource rather than just using it for ACLs. But I also go back and forth on whether it's worth putting useful methods in the resource, because it seems to make the application unnecessarily complex and dependent on Pyramid's resource API. Right now I'm not doing it, except in the arbitrary-URL application. Instead I looked at 'pyramid_services', which provides a nice way to define generic services or high-level queries and business logic. But I don't need the inferface/registry/adapter stuff it does, because I can't imagine ever having more than one implementation of something. So I'm starting with just regular service classes that take a request argument, in an 'appname/services' package. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
