On Jan 31, 2012, at 3:27 PM, Malthe Borch wrote:

> Another option – in terms of "the right thing" – is to derive an
> object that carries just to things you need from the request, e.g.
> "locale" and "logged in user", so that you don't pass around an HTTP
> request everywhere (and hence need to stub it out in tests).

FWIW that's what i ended up with, actually. the view extracts the filesystem 
root setting from the request and then just passes that particular setting to 
the helper methods that require it. in my testing i create a sandbox and pass 
*its* location to the helpers. presto, no request involved, no wsgi app 
instantiated!

> That object might be an "environment" in which code executes.

in my case that's an instance of a 'dropbox' class that receives a root path in 
its init.

i'm actually rather happy with how it turned out :)

tom

> 
> \malthe
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to 
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/pylons-discuss?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to