View Callables as a Class and Dependency Injection

2012-01-31 Thread papagr
Hello everyone, >From the object-oriented point of view, a Pyramid View (instance of a callable class) depends on the context and the request. Pyramid, correctly injects those dependencies into the view, during a view's class instantiation (while processing a Request). Assuming that a view depend

Re: View Callables as a Class and Dependency Injection

2012-01-31 Thread Chris McDonough
On Tue, 2012-01-31 at 15:09 -0800, papagr wrote: > Hello everyone, > > >From the object-oriented point of view, a Pyramid View (instance of a > callable class) depends on the context and the request. Pyramid, > correctly injects those dependencies into the view, during a view's > class instantiati

Re: View Callables as a Class and Dependency Injection

2012-02-01 Thread papagr
Hi Chris, On Feb 1, 2:21 am, Chris McDonough wrote: > On Tue, 2012-01-31 at 15:09 -0800, papagr wrote: > > Hello everyone, > > > >From the object-oriented point of view, a Pyramid View (instance of a > > callable class) depends on the context and the request. Pyramid, > > correctly injects those

Re: View Callables as a Class and Dependency Injection

2012-02-03 Thread Free Ekanayaka
Hi Nikolaos, |--==> On Wed, 1 Feb 2012 02:02:31 -0800 (PST), papagr said: [...] >>> Assuming that a view depends on other objects to do its job, is there >>> a preferred or suggested way of injecting other services >>> (dependencies) in a Pyramid view? By "injecting", I do not mean to us

Re: View Callables as a Class and Dependency Injection

2012-02-06 Thread Iain Duncan
You can always get more stuff out of the registry in your view's init method, making it behave like an adapter for more items. The ZCA registry can accomplish most of what you would normally use a dependency injection framework for, and is there as request.registry. Check out the online ZCA book.

Re: View Callables as a Class and Dependency Injection

2012-02-07 Thread papagr
Hi Free, Thanks for your feedback. On Feb 3, 10:44 am, Free Ekanayaka wrote: > Hi Nikolaos, > > |--==> On Wed, 1 Feb 2012 02:02:31 -0800 (PST), papagr > said: > > [...] > >   >>> Assuming that a view depends on other objects to do its job, is there >   >>> a preferred or suggested way of injec

Re: View Callables as a Class and Dependency Injection

2012-02-07 Thread papagr
Hi Iain, On Feb 6, 7:02 pm, Iain Duncan wrote: > You can always get more stuff out of the registry in your view's init > method, making it behave like an adapter for more items. The ZCA registry > can accomplish most of what you would normally use a dependency injection > framework for, and is th

Re: View Callables as a Class and Dependency Injection

2012-02-08 Thread Iain Duncan
> > On Feb 6, 7:02 pm, Iain Duncan wrote: > > You can always get more stuff out of the registry in your view's init > > method, making it behave like an adapter for more items. The ZCA registry > > can accomplish most of what you would normally use a dependency injection > > framework for, and is

Re: View Callables as a Class and Dependency Injection

2012-02-08 Thread Free Ekanayaka
Hi Nikolaos, |--==> On Tue, 7 Feb 2012 13:46:25 -0800 (PST), papagr said: [...] p> That's right. A ProjectRepository plays the role of a Context. p> Unfortunately, I have to work with a legacy SQL database and traversal p> is not a natural fit. It requires extra coding to setup a custom

Re: View Callables as a Class and Dependency Injection

2012-02-08 Thread Mike Orr
On Wed, Feb 8, 2012 at 9:37 AM, Free Ekanayaka wrote: > Hi Nikolaos, > > |--==> On Tue, 7 Feb 2012 13:46:25 -0800 (PST), papagr > said: > >  [...] >  p> That's right. A ProjectRepository plays the role of a Context. >  p> Unfortunately, I have to work with a legacy SQL database and traversal >  

Re: View Callables as a Class and Dependency Injection

2012-02-08 Thread Free Ekanayaka
Hi Mike, |--==> On Wed, 8 Feb 2012 11:19:49 -0800, Mike Orr said: MO> On Wed, Feb 8, 2012 at 9:37 AM, Free Ekanayaka wrote: >>Hi Nikolaos, >> >>|--==> On Tue, 7 Feb 2012 13:46:25 -0800 (PST), papagr said: >> >> [...] >> p> That's right. A ProjectRepository plays the role of a C

[pylons-discuss] Re: View Callables as a Class and Dependency Injection

2014-02-08 Thread Arialdo Martini
Hi Nikolaos. I'm very interested in achieving the same results you are trying to achieve. After having read the amazing post Rails is not your application I started taking into consideration a very different approach. I asked

Re: [pylons-discuss] Re: View Callables as a Class and Dependency Injection

2014-02-08 Thread Paul Winkler
Have you considered zope.component and zope.interface? On Feb 8, 2014 4:33 PM, "Arialdo Martini" wrote: > Hi Nikolaos. > I'm very interested in achieving the same results you are trying to > achieve. > > After having read the amazing post Rails is not your > application

Re: [pylons-discuss] Re: View Callables as a Class and Dependency Injection

2014-02-08 Thread Mike Orr
On Wed, Feb 5, 2014 at 11:25 PM, Arialdo Martini wrote: > Hi Nikolaos. > I'm very interested in achieving the same results you are trying to achieve. > > After having read the amazing post Rails is not your application I started > taking into consideration a very different approach. > I asked myse

Re: [pylons-discuss] Re: View Callables as a Class and Dependency Injection

2014-02-09 Thread Laurence Rowe
Having spent a lot of time with pytest over the past year, I think it could be interesting to make an IViewMapperFactory that supported dependency injection into view callables the same way that pytest fixtures are injected into test functions. While essentially be equivalent to request propert