diff options
| author | David Cramer | 2011-06-14 12:49:51 -0700 | 
|---|---|---|
| committer | David Cramer | 2011-06-14 12:49:51 -0700 | 
| commit | 7504141f19ef1bdaaf91d95461dad35ac84b5211 (patch) | |
| tree | e3a110296b02b1f665b0563f9ecfa244ebc8e0b4 /debug_toolbar/panels | |
| parent | 4ee67a1632f41a873d997ae15ac0a2eccca04430 (diff) | |
| parent | 2480ca97297a101b91e6287e9bd5acd4547e6bbd (diff) | |
| download | django-debug-toolbar-7504141f19ef1bdaaf91d95461dad35ac84b5211.tar.bz2 | |
Merge branch 'master' of github.com:django-debug-toolbar/django-debug-toolbar
Diffstat (limited to 'debug_toolbar/panels')
| -rw-r--r-- | debug_toolbar/panels/request_vars.py | 18 | ||||
| -rw-r--r-- | debug_toolbar/panels/sql.py | 2 | ||||
| -rw-r--r-- | debug_toolbar/panels/template.py | 2 | 
3 files changed, 16 insertions, 6 deletions
diff --git a/debug_toolbar/panels/request_vars.py b/debug_toolbar/panels/request_vars.py index 632068e..60214ae 100644 --- a/debug_toolbar/panels/request_vars.py +++ b/debug_toolbar/panels/request_vars.py @@ -9,6 +9,12 @@ class RequestVarsDebugPanel(DebugPanel):      name = 'RequestVars'      has_content = True +    def __init__(self, *args, **kwargs): +        DebugPanel.__init__(self, *args, **kwargs) +        self.view_func = None +        self.view_args = None +        self.view_kwargs = None +      def nav_title(self):          return _('Request Vars') @@ -29,18 +35,18 @@ class RequestVarsDebugPanel(DebugPanel):      def content(self):          context = self.context.copy() -        if hasattr(self.view_func, '__name__'): -            view_name = self.view_func.__name__ -        elif hasattr(self.view_func, '__class__'): -            view_name = self.view_func.__class__.__name__ +        if self.view_func is not None: +            module = self.view_func.__module__ +            name = getattr(self.view_func, '__name__', None) or getattr(self.view_func.__class__,'__name__','<unknown>') +            view_func = '%s.%s' % (module, name)          else: -            view_name = '<unknown>' +            view_func = '<no view>'          context.update({              'get': [(k, self.request.GET.getlist(k)) for k in self.request.GET],              'post': [(k, self.request.POST.getlist(k)) for k in self.request.POST],              'cookies': [(k, self.request.COOKIES.get(k)) for k in self.request.COOKIES], -            'view_func': '%s.%s' % (self.view_func.__module__, view_name), +            'view_func': view_func,              'view_args': self.view_args,              'view_kwargs': self.view_kwargs          }) diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index c6b5996..bce769a 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -183,8 +183,10 @@ class SQLDebugPanel(DebugPanel):                  query['rgb_color'] = self._databases[alias]['rgb_color']                  try:                      query['width_ratio'] = (query['duration'] / self._sql_time) * 100 +                    query['width_ratio_relative'] =  100.0 * query['width_ratio'] / (100.0 - width_ratio_tally)                  except ZeroDivisionError:                      query['width_ratio'] = 0 +                    query['width_ratio_relative'] = 0                  query['start_offset'] = width_ratio_tally                  query['end_offset'] = query['width_ratio'] + query['start_offset']                  width_ratio_tally += query['width_ratio'] diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py index 44b8b3e..3c70690 100644 --- a/debug_toolbar/panels/template.py +++ b/debug_toolbar/panels/template.py @@ -78,6 +78,8 @@ class TemplateDebugPanel(DebugPanel):              # Skip templates that we are generating through the debug toolbar.              if template.name and template.name.startswith('debug_toolbar/'):                  continue +            if not hasattr(template, 'origin'): +                continue              if template.origin and template.origin.name:                  template.origin_name = template.origin.name              else:  | 
