From 717dc6815a9d4ddcd30efc17db11ade0f8f38354 Mon Sep 17 00:00:00 2001 From: bkonkle Date: Thu, 15 Sep 2011 10:36:11 -0500 Subject: Edited all of the panels to use the stats API and not override the content method --- debug_toolbar/panels/cache.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'debug_toolbar/panels/cache.py') 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) + }) -- cgit v1.2.3