From 90433b744a0c2cf405642cf6f22e81fbf4e5d72d Mon Sep 17 00:00:00 2001 From: Anand Date: Mon, 24 Dec 2007 16:55:08 +0530 Subject: [PATCH] fix: web.profile behavior in python 2.5 (Bug#133080) --- web/utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/utils.py b/web/utils.py index ec7d3d08..e294c1ba 100644 --- a/web/utils.py +++ b/web/utils.py @@ -624,14 +624,18 @@ def __call__(self, *args): ##, **kw): kw unused stime = time.time() result = prof.runcall(self.func, *args) stime = time.time() - stime - prof.close() - stats = hotshot.stats.load(temp.name) - stats.strip_dirs() - stats.sort_stats('time', 'calls') + + def print_stats(): + stats = hotshot.stats.load(temp.name) + stats.strip_dirs() + stats.sort_stats('time', 'calls') + stats.print_stats(40) + stats.print_callers() + x = '\n\ntook '+ str(stime) + ' seconds\n' - x += capturestdout(stats.print_stats)(40) - x += capturestdout(stats.print_callers)() + x += capturestdout(print_stats)() + return result, x profile = Profile