Merge commit 'd886f5a606f26d78df457e7041c5666e0e5bbc6d'

This commit is contained in:
Matt Good
2012-01-04 08:42:21 -08:00
2 changed files with 8 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = True
# 'flask_debugtoolbar.panels.logger.LoggingPanel',
# 'flask_debugtoolbar.panels.timer.TimerDebugPanel',
#)
#app.config['DEBUG_TB_HOSTS'] = ('127.0.0.1', '::1' )
app.config['SECRET_KEY'] = 'asd'
app.config['DEBUG'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'

View File

@@ -34,6 +34,7 @@ class DebugToolbarExtension(object):
def __init__(self, app):
self.app = app
self.debug_toolbars = {}
self.hosts = ()
if not app.debug:
return
@@ -45,6 +46,8 @@ class DebugToolbarExtension(object):
DebugToolbar.load_panels(app)
self.hosts = app.config.get('DEBUG_TB_HOSTS', ())
self.app.before_request(self.process_request)
self.app.after_request(self.process_response)
@@ -90,6 +93,10 @@ class DebugToolbarExtension(object):
"""Return a boolean to indicate if we need to show the toolbar."""
if request.path.startswith('/_debug_toolbar/'):
return False
if len(self.hosts) and not request.remote_addr in self.hosts:
return False
return True
def send_static_file(self, filename):