Hi all,

It seems as if my "problem" really isn't one. Maybe I'm a little
overengineering, it wouldn't be for the first time ;)
Actually, I was going for something like this:


app = web.application(urls, globals(), handlerargs=[DB(), Auth()])


(i.e. you could pass arguments to your application that would be passed
on to your handler constructors. Of course this is purely fictional.)

Thanks anyway for your suggestions :)

Keep up the great work.
Cheers,
Ole.



Ole Trenner wrote:
> Hi all,
> 
> First of all, and since this is my first posting to this list, I want to
> thank everyone who helped in creating and maintaining web.py. I really
> like its non-intrusive and lightweight approach to solving my daily web
> app problems. It's great :)
> 
> Now while using it I've stumbled upon a small, let's call it inconvenience.
> 
> I usually use the class dispatching mechanism that instantiates some
> class for a matching request and calls a method depending on the request
> method (GET or POST or HEAD). In these instances I usually want to use a
> db connection, service, auth manager or whatever.
> My question is, how one would inject those dependencies into the
> generated instances.
> 
> To elaborate a little more:
> The dependencies could of course be instantiated in the default
> constructor of the class or in the GET/POST methods itself. But that
> makes testing the handlers at least more difficult.
> I surely know several ways around this problem, which mostly include
> global variables of sorts (globals, registries or whatever), but they
> all do not seem very elegant.
> 
> So how would you go about injecting dependencies into your handler
> instances (or don't you?)?
> 
> Thanks for your suggestions -
> Ole.
> 

-- 
Ole Trenner
<[email protected]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to