diff options
| author | Yann Malet | 2011-09-11 05:16:47 +0200 | 
|---|---|---|
| committer | Yann Malet | 2011-09-11 05:16:47 +0200 | 
| commit | d3649d340a9a7e20235fa63615830b9b0b7edbdd (patch) | |
| tree | 5fe5ca865e05dae467eb14b0e096b15cbacf8ddf /debug_toolbar/panels/profiling.py | |
| parent | 83357d374f6741a5cf50da5c4f3f29934ed3281b (diff) | |
| download | django-debug-toolbar-d3649d340a9a7e20235fa63615830b9b0b7edbdd.tar.bz2 | |
Fix the profiling panel when the line_profiler module is not available.
Diffstat (limited to 'debug_toolbar/panels/profiling.py')
| -rw-r--r-- | debug_toolbar/panels/profiling.py | 8 | 
1 files changed, 5 insertions, 3 deletions
| 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 = [] | 
