On Tue, Oct 30, 2012 at 1:17 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote: > With that, combined with the best-practice of passing the Request > object around during the request lifecycle, I wanted to suggest > creating a 'project' and 'plugin' namespace under request , so that > (moving forward) as people develop plugins or write app specific > request attributes there is no issue for collision against each other > or future Pyramid releases. > > - i fear namespace collision.
No doubt this is a concern. Fortunately request properties do fall under Pyramid's conflict resolution mechanism. A good convention is already possible by creating an object on request that exposes your methods. class RequestExtensions(object): def __init__(self, request): self.request = request @reify def some_cached_property(self): return 'foo' def some_method(self, **kw): return 'bar' config.add_request_method(RequestExtensions, 'myplugin', reify=True) will allow request.myplugin.some_api request.myplugin.some_method() I'm not sure Pyramid needs any sugar over top of this pattern. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.