On Tue, Jan 3, 2012 at 6:24 PM, Christoph Zwerschke <[email protected]> wrote:
> Finally got around trying out the debugbar. Nice - you really deserve a beer
> or two for adding such useful stuff. I say we should activate it by default
> in the next release so that nobody can miss it.
>
> One small problem I experienced was that when the _debugbar controller was
> mounted, it tried to import the root controller which was not yet possible
> at that point in time. I saw you tried to fix this by delaying the mounting
> using an after_config hook in
> https://bitbucket.org/_amol_/tgext.debugbar/changeset/589ca2137ce0. But that
> is still to early in my case, because my root controller imports some
> ToscaWidget that needs the url() function on creation time which in turn
> references the request which is not yet available at that point in time. My
> solution was to defer the mounting even further, into the render_bars
> function. I can submit a patch if you like.

Hi Christoph,
Thanks for your tests, I really appreciate them.

About the controllers.util.url reference to the request is the reason
why controllers.util.lurl function was added.
I think that the best solution is probably to let global objects (like
TW Forms) use lurl as they use l_, otherwise we would have to remount
(or try to remount) the debugbar on each request.

Also calling url at import time might cause issues as you get the
request state of the first request (when pylons caches the controller)
and not of the current request. SCRIPT_NAME won't probably change
between two requests, but it might actually happen if you run the same
application multiple times on different paths inside only one WSGI
process (this is what I do with ACRCMS to avoid consuming RAM for each
website it is serving).

So I would suggest you to change url calls to lurl calls so that you
controller gets importable outside requests.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to