diff options
| author | Apkawa | 2011-10-27 00:08:23 +0400 |
|---|---|---|
| committer | Apkawa | 2011-10-27 00:08:23 +0400 |
| commit | e455bec46f7beb92526acf100d269d88c2ede064 (patch) | |
| tree | 4888892ead8db417ad6b7034c2c66b9052c63594 | |
| parent | 0e262aefe7b272ac8d8725f2af2f304a26f20927 (diff) | |
| download | django-debug-toolbar-e455bec46f7beb92526acf100d269d88c2ede064.tar.bz2 | |
fixed AttributeError on 404 page exception in ProfilerPanel.process_response
| -rw-r--r-- | debug_toolbar/middleware.py | 1 | ||||
| -rw-r--r-- | debug_toolbar/panels/profiling.py | 5 | ||||
| -rw-r--r-- | example/example.db | bin | 55296 -> 55296 bytes | |||
| -rw-r--r-- | example/settings.py | 37 |
4 files changed, 41 insertions, 2 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index f49a29f..8f0445a 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -74,7 +74,6 @@ class DebugToolbarMiddleware(object): def process_request(self, request): __traceback_hide__ = True if self.show_toolbar(request): - urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF) if isinstance(urlconf, basestring): urlconf = import_module(getattr(request, 'urlconf', settings.ROOT_URLCONF)) diff --git a/debug_toolbar/panels/profiling.py b/debug_toolbar/panels/profiling.py index 9683111..d07fd2a 100644 --- a/debug_toolbar/panels/profiling.py +++ b/debug_toolbar/panels/profiling.py @@ -163,7 +163,7 @@ class ProfilingDebugPanel(DebugPanel): self._unwrap_closure_and_profile(cell.cell_contents) def process_view(self, request, view_func, view_args, view_kwargs): - print "process_view", view_func + __traceback_hide__ = True self.profiler = cProfile.Profile() args = (request,) + view_args if DJ_PROFILE_USE_LINE_PROFILER: @@ -189,6 +189,9 @@ class ProfilingDebugPanel(DebugPanel): self.add_node(func_list, subfunc, max_depth, cum_time=cum_time) def process_response(self, request, response): + __traceback_hide__ = True + if not hasattr(self, 'profiler'): + return None self.profiler.create_stats() self.stats = DjangoDebugToolbarStats(self.profiler) if DJ_PROFILE_USE_LINE_PROFILER: diff --git a/example/example.db b/example/example.db Binary files differindex 443f173..dbbe0c9 100644 --- a/example/example.db +++ b/example/example.db diff --git a/example/settings.py b/example/settings.py index 279db7e..c421a62 100644 --- a/example/settings.py +++ b/example/settings.py @@ -51,4 +51,41 @@ DEBUG_TOOLBAR_PANELS = ( CACHE_BACKEND = 'dummy://' #CACHE_BACKEND = 'memcached://127.0.0.1:11211' +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + }, + }, + 'handlers': { + 'null': { + 'level':'DEBUG', + 'class':'django.utils.log.NullHandler', + }, + 'console':{ + 'level':'DEBUG', + 'class':'logging.StreamHandler', + 'formatter': 'verbose' + }, + }, + 'loggers': { + 'django': { + 'handlers':['null'], + 'propagate': True, + 'level':'INFO', + }, + 'django.request': { + 'handlers': ['console'], + 'level': 'ERROR', + 'propagate': False, + }, + 'django.db.backends': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + } +} |
