Am 03.01.2012 19:01, schrieb Alessandro Molina:
About the controllers.util.url reference to the request is the reason
why controllers.util.lurl function was added.
... for which you should get another beer ;-) You're right, that's a
good use case for lurl(). It just didn't exist when I wrote that
application, will change that now.
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.
Using lurl is the proper solution. But I think tgext.debugbar should
also work with old apps or apps which are not written properly, since
the error message you get from debugbar is hard to understand for
newbies, and the debugbar should be as "transparent" as possible.
Mounting the debugbar should of course only be done at the first call of
render_bars().
Some other ideas for refactoring (just thinking out loud):
* The render_bars() function could be promoted to a method of the
DebugBarSetupper class and cache the rendered template on the first call
using an attribute of that class.
* The class should then be renamed to DebugBarHooks or just DebugBar
* Returning the response as list of html segments would be more
performant than doing the two replace operations in render_bars()
This is all straight forward, except that doing stuff on the first call
must be done in a thread-safe manner or that first call stuff must be
done in a way that executing it twice will not do harm.
-- Christoph
--
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.