diff options
Diffstat (limited to 'debug_toolbar/panels')
| -rw-r--r-- | debug_toolbar/panels/profiling.py | 8 | ||||
| -rw-r--r-- | debug_toolbar/panels/signals.py | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/debug_toolbar/panels/profiling.py b/debug_toolbar/panels/profiling.py index f71472b..995cccb 100644 --- a/debug_toolbar/panels/profiling.py +++ b/debug_toolbar/panels/profiling.py @@ -155,12 +155,12 @@ class ProfilingDebugPanel(DebugPanel): return _('Profiling') def _unwrap_closure_and_profile(self, func): - if not hasattr(func, 'func_code'): + if not hasattr(func, '__code__'): return self.line_profiler.add_function(func) - if func.func_closure: - for cell in func.func_closure: - if hasattr(cell.cell_contents, 'func_code'): + if func.__closure__: + for cell in func.__closure__: + if hasattr(cell.cell_contents, '__code__'): self._unwrap_closure_and_profile(cell.cell_contents) def process_view(self, request, view_func, view_args, view_kwargs): diff --git a/debug_toolbar/panels/signals.py b/debug_toolbar/panels/signals.py index d6a5b2e..d3d9cfc 100644 --- a/debug_toolbar/panels/signals.py +++ b/debug_toolbar/panels/signals.py @@ -89,9 +89,9 @@ class SignalDebugPanel(DebugPanel): receiver = getattr(receiver, '__wraps__', receiver) receiver_name = getattr(receiver, '__name__', str(receiver)) - if getattr(receiver, 'im_self', None) is not None: - text = "%s.%s" % (getattr(receiver.im_self, '__class__', type).__name__, receiver_name) - elif getattr(receiver, 'im_class', None) is not None: + if getattr(receiver, '__self__', None) is not None: + text = "%s.%s" % (getattr(receiver.__self__, '__class__', type).__name__, receiver_name) + elif getattr(receiver, 'im_class', None) is not None: # Python 2 only text = "%s.%s" % (receiver.im_class.__name__, receiver_name) else: text = "%s" % receiver_name |
