aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/panels/cache.py
diff options
context:
space:
mode:
authorbkonkle2011-09-15 10:36:11 -0500
committerbkonkle2011-09-15 10:36:11 -0500
commit717dc6815a9d4ddcd30efc17db11ade0f8f38354 (patch)
tree5f3a3fceefe9bead41019c3216991337cc12fe6f /debug_toolbar/panels/cache.py
parented9bca7c00f6f326842d79e843f678787fac8b15 (diff)
downloaddjango-debug-toolbar-717dc6815a9d4ddcd30efc17db11ade0f8f38354.tar.bz2
Edited all of the panels to use the stats API and not override the content method
Diffstat (limited to 'debug_toolbar/panels/cache.py')
-rw-r--r--debug_toolbar/panels/cache.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/debug_toolbar/panels/cache.py b/debug_toolbar/panels/cache.py
index ad3f844..c9dae6d 100644
--- a/debug_toolbar/panels/cache.py
+++ b/debug_toolbar/panels/cache.py
@@ -3,9 +3,7 @@ import inspect
from django.core import cache
from django.core.cache.backends.base import BaseCache
-from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
-from debug_toolbar.middleware import DebugToolbarMiddleware
from debug_toolbar.panels import DebugPanel
class CacheStatTracker(BaseCache):
@@ -75,6 +73,7 @@ class CacheDebugPanel(DebugPanel):
Panel that displays the cache statistics.
"""
name = 'Cache'
+ template = 'debug_toolbar/panels/cache.html'
has_content = True
def __init__(self, *args, **kwargs):
@@ -97,15 +96,8 @@ class CacheDebugPanel(DebugPanel):
return ''
def process_response(self, request, response):
- self.stats = {
+ self.record_stats({
'cache_calls': len(self.cache.calls),
'cache_time': self.cache.total_time,
'cache': self.cache,
- }
- toolbar = DebugToolbarMiddleware.get_current()
- toolbar.stats['cache'] = self.stats
-
- def content(self):
- context = self.context.copy()
- context.update(self.stats)
- return render_to_string('debug_toolbar/panels/cache.html', context)
+ })