Add DEBUG_TB_PANELS setting, so you can change the ordering and add/remove panels

This commit is contained in:
Daniel Haaker
2011-02-04 23:54:46 +01:00
parent 8ddc7ecbc7
commit 1f6f38bbec
2 changed files with 15 additions and 9 deletions
+5
View File
@@ -9,6 +9,11 @@ from flaskext.debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = True
app.config['DEBUG_TB_PANELS'] = (
'flaskext.debugtoolbar.panels.headers.HeaderDebugPanel',
'flaskext.debugtoolbar.panels.logger.LoggingPanel',
'flaskext.debugtoolbar.panels.timer.TimerDebugPanel',
)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)
+10 -9
View File
@@ -9,6 +9,15 @@ class DebugToolbar(object):
# default config settings
self.config = {
'DEBUG_TB_INTERCEPT_REDIRECTS': True,
'DEBUG_TB_PANELS': (
'flaskext.debugtoolbar.panels.versions.VersionDebugPanel',
'flaskext.debugtoolbar.panels.timer.TimerDebugPanel',
'flaskext.debugtoolbar.panels.headers.HeaderDebugPanel',
'flaskext.debugtoolbar.panels.request_vars.RequestVarsDebugPanel',
'flaskext.debugtoolbar.panels.template.TemplateDebugPanel',
'flaskext.debugtoolbar.panels.sqlalchemy.SQLAlchemyDebugPanel',
'flaskext.debugtoolbar.panels.logger.LoggingPanel',
)
}
self.config.update(current_app.config)
@@ -16,15 +25,7 @@ class DebugToolbar(object):
'static_path': url_for('_debug_toolbar.static', filename='')
}
self.default_panels = [
'flaskext.debugtoolbar.panels.versions.VersionDebugPanel',
'flaskext.debugtoolbar.panels.timer.TimerDebugPanel',
'flaskext.debugtoolbar.panels.headers.HeaderDebugPanel',
'flaskext.debugtoolbar.panels.request_vars.RequestVarsDebugPanel',
'flaskext.debugtoolbar.panels.template.TemplateDebugPanel',
'flaskext.debugtoolbar.panels.sqlalchemy.SQLAlchemyDebugPanel',
'flaskext.debugtoolbar.panels.logger.LoggingPanel',
]
self.default_panels = self.config['DEBUG_TB_PANELS']
self.load_panels()