On Jan 31, 2012, at 2:59 PM, Chris McDonough wrote:

> If you did what that thing suggested you'd likely write a small wrapper
> to run your app instead of using paster serve, so there'd be no "twice".
> Or at least you can arrange to do that with enough imagination.

true. 
> 
>>> I personally find that global settings makes my test code much more 
>>> brittle, because it means I have to clean up the settings after changing 
>>> them within test code instead of just saying "request.settings = {}". But 
>>> at the end of the day, it's really up to you.
>> 
>> ah, i just give each test a new instance of the settings, so there's no need 
>> to clean up.
>> 
>> i really would like to have a clean, convenient and supported way to access 
>> global settings. i guess, the answer is that pyramid currently doesn't have 
>> this on offer.
> 
> No, it doesn't, or at least it leaves it up to you.  Individuals can
> always make nonglobal things global, but a framework can't make things
> nonglobal once it makes them global.

makes sense.
> 
>> generically exposing the settings that were used to invoke a pyramid 
>> instance on module level would be nice, but i infer from what you've said 
>> the the convenience that would add would be outweighed by the stuff that 
>> could possibly go wrong. correct?
> 
> The Django core devs I've heard always lament using global settings.
> The zope.testing.setUp stuff that clears a module scope registry is
> another antipattern.
> 
>> maybe i could just mock get_current_registry() in my test harness and simply 
>> use that in the few places of my code that does not have convenient access 
>> to a request.
> 
> I dunno.  If you want global stuff it's easy enough to make things
> global if you use a little thought.  Or just pass the request around.

like i mentioned, i've meanwhile realized that my problem was in poor (or no) 
design of what needs to be done where. once i re-arranged the furniture, the 
problem went away.

passing the request around seems the right thing™ to do. at least now i know 
*why* instead of just blindly cargo-culting :)

cheers,

tom

> 
> - C
> 
> 
> -- 
> 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