Files
flask-debugtoolbar/flask_debugtoolbar/panels/template.py
Michael van Tellingen 1c594b9ba3 Attempt to fix the flask-debugtoolbar:
- Rename the package to flask_debugtoolbar
 - Fix importing of the panels so that the views in the panels are correctly registered in the blueprint


There is still one major problem in the sqlalchemy panel where we are not able to get the SQLAlchemy reference
2011-10-17 21:27:51 +02:00

45 lines
1.0 KiB
Python

from flask import template_rendered
from flask_debugtoolbar.panels import DebugPanel
_ = lambda x: x
class TemplateDebugPanel(DebugPanel):
"""
Panel that displays the time a response took in milliseconds.
"""
name = 'Template'
has_content = True
def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs)
self.templates = []
template_rendered.connect(self._store_template_info)
def _store_template_info(self, sender, **kwargs):
self.templates.append(kwargs)
def process_request(self, request):
pass
def process_response(self, request, response):
pass
def nav_title(self):
return _('Templates')
def nav_subtitle(self):
return "%d rendered" % len(self.templates)
def title(self):
return _('Templates')
def url(self):
return ''
def content(self):
return self.render('panels/template.html', {
'templates': self.templates
})