aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug_toolbar/panels/staticfiles.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py
index 0ecba51..9813609 100644
--- a/debug_toolbar/panels/staticfiles.py
+++ b/debug_toolbar/panels/staticfiles.py
@@ -31,7 +31,7 @@ class StaticFile(object):
def __init__(self, path):
self.path = path
- def __unicode__(self):
+ def __str__(self):
return self.path
def real_path(self):
@@ -75,8 +75,6 @@ class DebugConfiguredStorage(LazyObject):
self._wrapped = DebugStaticFilesStorage(collector)
-storage.staticfiles_storage = staticfiles.staticfiles_storage = DebugConfiguredStorage()
-
class StaticFilesPanel(panels.Panel):
"""
@@ -95,6 +93,13 @@ class StaticFilesPanel(panels.Panel):
self.num_found = 0
self._paths = {}
+ def enable_instrumentation(self):
+ self._unpatched_staticfiles_storage = storage.staticfiles_storage
+ storage.staticfiles_storage = staticfiles.staticfiles_storage = DebugConfiguredStorage()
+
+ def disable_instrumentation(self):
+ storage.staticfiles_storage = staticfiles.staticfiles_storage = self._unpatched_staticfiles_storage
+
@property
def has_content(self):
if "django.contrib.staticfiles" not in settings.INSTALLED_APPS: