Ok, thank you all for your suggestions. I'll experiment a bit :)

On Mar 6, 12:38 pm, "Florent Aide" <[EMAIL PROTECTED]> wrote:
> Hi remi,
>
> Or we could send a callback in the dict and this callback would be
> called at the end of the kid template and render the elapsed_time...
> an example controllers.py (from quickstart):
>
> --------
> from turbogears import controllers, expose
> from turbogears import widgets
> import turbogears as tg
>
> import time
>
> def render_elapsed(start):
>     end = time.time()
>     elapsed_time = end - float(start)
>     return "%s" % elapsed_time
>
> class Root(controllers.RootController):
>     @expose(template="tmc.templates.welcome")
>     def index(self):
>         return dict(start=time.time(), render_elapsed=render_elapsed)
>
> --------
>
> in your kid template at the end of the kid file add this:
>
> --------
>         This page took :
>     <span py:replace="render_elapsed(start)">elapsedtime</span>
>     second(s) to render.
> --------
> This method would be a little less precise than the decorator one but
> has the advantage of being able to easily display the info like the
> PHP-based solutions do.
>
> But my first option if I wanted to be more precise thant this would be
> to look into the filter Robert talked about IMHO (In general Robert is
> of really good advice).
>
> The technique described here will not take into account the cherrypy
> routing process and what happens after kid has computed your template.
> It will give you an idea of your code execution time + you kid (or
> other...) template computation time.
>
> Regards,
>
> Florent AIDE.


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