From 5d2f897d45736b441024cbcdc720e9d8826e2afe Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Sun, 7 Sep 2008 12:08:32 -0700 Subject: Updated README: Added note about depending on jQuery for now. Added documentation on new HTTP headers panel. --- README.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 63743bb..0e557dc 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,7 @@ Currently, the following panels have been written and are working: - Django version - SQL queries including time to execute - Request timer +- Common HTTP headers If you have ideas for other panels please let us know. @@ -37,6 +38,7 @@ Installation 'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.timer.TimerDebugPanel', + 'debug_toolbar.panels.headers.HeaderDebugPanel', ) You can change the ordering of this tuple to customize the order of the @@ -45,11 +47,16 @@ Installation #. Add `debug_toolbar` to your `INSTALLED_APPS` setting so Django can find the the template files associated with the Debug Toolbar. +#. The UI effects of the Toolbar currently depend on jQuery to be already + included in your templates. So currently to test out the toolbar jQuery + already needs to be loaded on the page. We'll need a solution for this at + some point. + TODO ==== - Add more panels - Panel idea: Show some commonly used settings from settings.py - Panel idea: Show GET and POST variables -- Panel idea: Show HTTP header information - Panel idea: AJAX call to show cprofile data similar to the ?prof idea -- Get fancy with CSS and Javascript +- CSS Stylings +- Remove dependency on jQuery and come up with a general workable solution. -- cgit v1.2.3 From b4f14501ca759a7bdcc553c3c97a60819f904cdc Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Sun, 7 Sep 2008 12:20:56 -0700 Subject: Fixed a bug where the toolbar may have not been instantiated on request but tried to access it on response. --- debug_toolbar/middleware.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 57222c5..870dbb8 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -18,14 +18,21 @@ class DebugToolbarMiddleware(object): def __init__(self): self.debug_toolbar = None + def show_toolbar(self, request): + if not settings.DEBUG: + return False + if not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: + return False + return True + def process_request(self, request): - if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: + if self.show_toolbar(request): self.debug_toolbar = DebugToolbar(request) self.debug_toolbar.load_panels() return None def process_response(self, request, response): - if settings.DEBUG: + if self.show_toolbar(request): if response['Content-Type'].split(';')[0] in _HTML_TYPES and not request.is_ajax(): #response.content = _END_HEAD_RE.sub(mark_safe(self.debug_toolbar.render_styles() + "%s" % match.group()), response.content) response.content = _END_BODY_RE.sub(mark_safe(self.debug_toolbar.render_toolbar() + ''), response.content) -- cgit v1.2.3