diff --git a/CHANGES b/CHANGES index 284c95d0..a8543e6c 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Version 1.0 (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 additional keyword arguments to the constructor of :attr:`flask.Flask.test_client_class`. diff --git a/docs/api.rst b/docs/api.rst index 69ef38b5..70be5ca2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -538,6 +538,23 @@ The following signals exist in Flask: from flask import template_rendered 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 This signal is sent when the request context is set up, before