From bdbe57d6e13241f852860336f55bca0d88bd4384 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Mon, 9 Dec 2013 19:11:38 +0100 Subject: Storing the original on module level. --- debug_toolbar/panels/staticfiles.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index 9813609..f212f2b 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -75,6 +75,8 @@ class DebugConfiguredStorage(LazyObject): self._wrapped = DebugStaticFilesStorage(collector) +_original_storage = storage.staticfiles_storage + class StaticFilesPanel(panels.Panel): """ @@ -94,11 +96,10 @@ class StaticFilesPanel(panels.Panel): 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 + storage.staticfiles_storage = staticfiles.staticfiles_storage = _original_storage @property def has_content(self): -- cgit v1.2.3