before_render_template signal

This commit is contained in:
Alexander Pantyukhin 2015-03-23 08:09:21 +00:00 committed by Markus Unterwaditzer
parent cb9f645081
commit d53d5c732b
4 changed files with 29 additions and 3 deletions

View file

@ -12,7 +12,7 @@ from jinja2 import BaseLoader, Environment as BaseEnvironment, \
TemplateNotFound
from .globals import _request_ctx_stack, _app_ctx_stack
from .signals import template_rendered
from .signals import template_rendered, before_render_template
def _default_template_ctx_processor():
@ -102,6 +102,7 @@ class DispatchingJinjaLoader(BaseLoader):
def _render(template, context, app):
"""Renders the template and fires the signal"""
before_render_template.send(app, template=template, context=context)
rv = template.render(context)
template_rendered.send(app, template=template, context=context)
return rv