[web2py] Re: Run code before and after functions (statsd issue)

2015-12-17 Thread Anthony
No, as is, that will only wrap the function itself. However, you can explicitly execute the view and return the rendered HTML instead of the dictionary from the function: def statsd(f): blah.start() result = f() if isinstance(result, dict): result = response.render(result)

[web2py] Re: Run code before and after functions (statsd issue)

2015-12-17 Thread Octavian G
It works great ! Thanks. One question tho: it should include the time spent rendering the html view, right ? On Wednesday, December 16, 2015 at 11:10:11 PM UTC+2, Anthony wrote: > > response._caller is a function that wraps all controller actions, so > something like this might work: > > def sta

[web2py] Re: Run code before and after functions (statsd issue)

2015-12-16 Thread Anthony
response._caller is a function that wraps all controller actions, so something like this might work: def statsd(f): blah.start() result = f() blah.stop() return result response._caller = statsd Anthony On Wednesday, December 16, 2015 at 2:49:25 PM UTC-5, Octavian G wrote: > > H