I should point out that none of this is really new. It just formalizes the pattern that I use for other people. It helps me organize my code better. A lot of this idea is perfectly accomplished using simple `config.add_request_method` logic to add services to your request if you're not interested in using Interfaces or contexts but rather just a name-based lookup.
The services I end up writing with this pattern tend to have no dependencies on pyramid, and I most of them end up being created and used in offline jobs as well. Just without going through pyramid_services to create them. On Tue, Feb 17, 2015 at 10:13 AM, Vincent Catalano <[email protected]> wrote: > Nice work, Michael! I will definitely be incorporating this in my next > project. > > On Tue, Feb 17, 2015 at 8:48 AM, Bert JW Regeer <[email protected]> wrote: >> >> And I just added this to my setup.py, and removed the copy I had made of >> your gist. >> >> Bert >> >> > On Feb 17, 2015, at 01:34 , Michael Merickel <[email protected]> wrote: >> > >> > Hey everyone, >> > >> > I've been using some patterns within Pyramid for a while to create >> > service layers in my web apps. They allow me to keep all database >> > connections and queries and any other business logic out of my views, >> > and even off of the request object. I've packaged these helpers into a >> > small library named pyramid_services. >> > >> > The library boils down to basically 2 methods. >> > `config.register_service_factory()` and `request.find_service()` and >> > it can be used with zope interfaces to lookup objects, or with simple >> > strings as well. >> > >> > https://pypi.python.org/pypi/pyramid_services >> > https://github.com/mmerickel/pyramid_services >> > >> > I hope you find it useful. >> > >> > - Michael Merickel >> > >> > -- >> > 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. >> >> -- >> 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. > > > > > -- > Vincent Catalano > Software Engineer and Web Developer, > (520).603.8944 > > -- > 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. -- 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.
