From d3649d340a9a7e20235fa63615830b9b0b7edbdd Mon Sep 17 00:00:00 2001 From: Yann Malet Date: Sun, 11 Sep 2011 05:16:47 +0200 Subject: Fix the profiling panel when the line_profiler module is not available. --- debug_toolbar/panels/profiling.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'debug_toolbar') diff --git a/debug_toolbar/panels/profiling.py b/debug_toolbar/panels/profiling.py index 623b27a..e57aa97 100644 --- a/debug_toolbar/panels/profiling.py +++ b/debug_toolbar/panels/profiling.py @@ -123,7 +123,8 @@ class FunctionCall(object): return 16 * self.depth def line_stats_text(self): - if self._line_stats_text is None: + if (self._line_stats_text is None and + DJ_PROFILE_USE_LINE_PROFILER): lstats = self.statobj.line_stats if self.func in lstats.timings: out = StringIO() @@ -188,12 +189,13 @@ class ProfilingDebugPanel(DebugPanel): func.has_subfuncs = False if func.depth < max_depth: for subfunc in func.subfuncs(): - if subfunc.stats[3] >= cum_time or (subfunc.func in self.stats.line_stats.timings): + if (subfunc.stats[3] >= cum_time or + (hasattr(self.stats, 'line_stats') and + (subfunc.func in self.stats.line_stats.timings))): func.has_subfuncs = True self.add_node(func_list, subfunc, max_depth, cum_time=cum_time) def content(self): - import ipdb; ipdb.set_trace() root = FunctionCall(self.stats, self.stats.get_root_func(), depth=0) func_list = [] -- cgit v1.2.3