hi there,

i was getting tired of either a) having to pass in the request all over the 
place (mainly from views down to helper methods) in order for the latter to 
have access to the settings via request.settings or b) having to call 
get_current_registry() all the time (which would mean my tests require some 
additional setup foo) so i tried this in the myapp/__init__.py:

from pyramid.config import Configurator
settings = dict()


def main(global_config, **_settings):
   config = Configurator(settings=_settings)
   import myapp
   myapp.settings = _settings
   config.scan()
   return config.make_wsgi_app()

and henceforth wherever i need access to the settings:

from myapp import settings
...

settings['myapp.foo']

is this a bad idea? it seems 'dirty' but it would keep my tests and code 
significantly leaner...

any opinions?

cheers,

tom

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