On 5/30/07, Philip Jenvey <[EMAIL PROTECTED]> wrote: > > > On May 30, 2007, at 4:43 PM, Mike Orr wrote: > > > > > On 5/30/07, Mike Orr <[EMAIL PROTECTED]> wrote: > >> On 5/30/07, Mike Orr <[EMAIL PROTECTED]> wrote: > >>> On 5/30/07, Philip Jenvey <[EMAIL PROTECTED]> wrote: > >>>> > >>>> > >>>> On May 30, 2007, at 3:27 PM, Mike Orr wrote: > >>>> > >>>>> > >>>>> My app can find paste.deploy.CONFIG['sqlalchemy.echo_pool'] > >>>>> when run > >>>>> under 'paster shell', but it moves to > >>>>> CONFIG['app_conf']['sqlalchemy.echo_pool'] under 'paster > >>>>> serve'. Yet > >>>>> myapp/config/middleware.py contains: > >> > >> Ayayay! CONFIG is correct throughout middleware.py, but it changes > >> sometime before myapp/lib/base.py is imported. > > > > > > OK, it happens in paste.deploy.config line 163. Before > > CONFIG.push_thread_config(conf), CONFIG contains all the app config > > values. After that line, CONFIG contains just two keys: 'app_conf' > > and 'global_conf'. > > > > The code before that line is: > > > > # PasteDeploy 1.3 > > # paste/deploy/config.py > > class ConfigMiddleware(object): > > def __call__(self, environ, start_response): > > global wsgilib > > if wsgilib is None: > > import pkg_resources > > pkg_resources.require('Paste') > > from paste import wsgilib > > popped_config = None > > if 'paste.config' in environ: > > popped_config = environ['paste.config'] > > conf = environ['paste.config'] = self.config.copy() > > app_iter = None > > > > CONFIG.push_thread_config(conf) > > > > So does anybody know why Paste is doing this? Why does it need to > > override my nicely set CONFIG with the one in environ['paste.config'], > > and why is that one being set wrong? > > CONFIG is similar to a StackedObjectProxy in that a configuration is > registered for the current thread/app. The 'conf' here pushed onto > CONFIG is the conf passed to ConfigMiddleware. You must not be > passing it a new style merged config dict in your middleware.py
OK, I replaced: app = ConfigMiddleware(app, {'app_conf': app_conf, 'global_conf': global_conf}) with: app = ConfigMiddleware(app, conf) I guess everybody who's converting old projects will have to do this as well as modifying the top of middleware/make_app . -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---