aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/middleware.py
diff options
context:
space:
mode:
authorDavid Cramer2011-05-26 02:27:10 -0700
committerDavid Cramer2011-05-26 02:27:10 -0700
commit384d144fa68dd7468c05556137395612f8195eb0 (patch)
tree97e039f07a639153fe42516c134e88beb4bbd03f /debug_toolbar/middleware.py
parent5c6dbbc40a679b6bd5b7e81f7968d7ca54e3cab4 (diff)
downloaddjango-debug-toolbar-384d144fa68dd7468c05556137395612f8195eb0.tar.bz2
only load the toolbar if DEBUG, TEST, or INTERNAL_IPS match
Diffstat (limited to 'debug_toolbar/middleware.py')
-rw-r--r--debug_toolbar/middleware.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 3089b63..8d77297 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -62,10 +62,8 @@ class DebugToolbarMiddleware(object):
remote_addr = x_forwarded_for.split(',')[0].strip()
else:
remote_addr = request.META.get('REMOTE_ADDR', None)
- if not remote_addr in settings.INTERNAL_IPS \
- or (request.is_ajax() and \
- not debug_toolbar.urls._PREFIX in request.path) \
- or not (settings.DEBUG and not getattr(settings, 'TEST', False)):
+ # if not internal ip, and not DEBUG or TEST
+ if not (remote_addr in settings.INTERNAL_IPS or settings.DEBUG or getattr(settings, 'TEST', False)):
return False
return True