Changes and docs are modified.

This commit is contained in:
Alexander Pantyukhin 2015-06-17 11:59:04 +00:00 committed by Markus Unterwaditzer
parent 5e12748d0e
commit a9066a3756
2 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@ Version 1.0
(release date to be announced, codename to be selected) (release date to be announced, codename to be selected)
- Added before_render_template signal.
- Added `**kwargs` to :meth:`flask.Test.test_client` to support passing - Added `**kwargs` to :meth:`flask.Test.test_client` to support passing
additional keyword arguments to the constructor of additional keyword arguments to the constructor of
:attr:`flask.Flask.test_client_class`. :attr:`flask.Flask.test_client_class`.

View File

@ -538,6 +538,23 @@ The following signals exist in Flask:
from flask import template_rendered from flask import template_rendered
template_rendered.connect(log_template_renders, app) template_rendered.connect(log_template_renders, app)
.. data:: flask.before_render_template
:noindex:
This signal is sent before template rendering process. The
signal is invoked with the instance of the template as `template`
and the context as dictionary (named `context`).
Example subscriber::
def log_template_renders(sender, template, context, **extra):
sender.logger.debug('Rendering template "%s" with context %s',
template.name or 'string template',
context)
from flask import before_render_template
before_render_template.connect(log_template_renders, app)
.. data:: request_started .. data:: request_started
This signal is sent when the request context is set up, before This signal is sent when the request context is set up, before