On Wed, Mar 17, 2010 at 11:24 AM, Wyatt Baldwin <[email protected]> wrote: > On Mar 17, 10:27 am, Eric Lemoine <[email protected]> wrote: >> Hello >> >> From a controller can I get a reference to the app (i.e. what's >> returned by middleware.make_app)? > > Right before `return app`, you could do `app_globals.app = app` (in > fact, I think the docs for 1.0 say to do `config.app = app` anyway).
I think Pylons did that as a kludge because it needed access to the app. (The config initialization was reorganized to make it friendlier to nested applications, and apparently that severed the direct link between the app and some part of Pylons.) I'm not sure if I like setting ``config.app`` that way, but I'm not sure it's necessarily bad either. ``config`` is where I'd look for the app if I were trying to find it. > However... there's a potential issue here in that if you define > filters or a pipeline in your paste config, the app returned by > make_app will be wrapped with those other apps, so the one you saved > won't be the "root" app, which may or may not matter for your > scenario. > > Having said that, it seems to me that there *must* be another way to > get at the "root" app, but I didn't dig very hard. I also ended up > rewriting the code I had that utilized `app`. I'm not sure, but it > might be a bad practice to use/need `app` in that way. Not sure about this. Paste.composite is outside the realm of what the application code should be caring about? -- 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 [email protected]. 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.
