On Tue, Feb 17, 2015 at 10:32 PM, Mike Orr <[email protected]> wrote: > I like having a standard way to do this, and I haven't been entirely > satisfied with other ways to manage things like Redis connections and > login code, and making them request attributes. But if the objects > aren't going to change for the lifetime of the application and are > thread-safe and you don't need an interface, what's the advantage over > putting them in settings or as a registry attribute on startup? It > seems like that's a lot of unnecessary overhead and potential points > of failure.
That's up to you to decide. The api supports registering singletons as well via `config.register_service` which means they can be very similar to registry attributes but it is a standard interface that can do more than just a simple registry attribute since you probably aren't using singletons for everything. A standard interface means your view doesn't need to know this stuff, which can be nice. > And how would you set up a request in a unit test, if you're just > calling a view method and not instantiating an entire app? Luckily for you I've added a new `pyramid.request.apply_request_extensions` API that will be shipping with soon with Pyramid 1.6 and will allow testing of request methods without requiring webtest and/or the router. -- 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.
