Fixed a documentation error. This fixes #143

This commit is contained in:
Armin Ronacher 2010-11-19 13:25:45 +01:00
parent 858806da69
commit 2ac1b7d438
1 changed files with 10 additions and 3 deletions

View File

@ -81,16 +81,23 @@ context are appended to it.
Additionally there is a convenient helper method
(:meth:`~blinker.base.Signal.connected_to`). that allows you to
temporarily subscribe a function to a signal with is a context manager on
its own which simplifies the example above::
its own. Because the return value of the context manager cannot be
specified that way one has to pass the list in as argument::
from flask import template_rendered
def captured_templates(app):
recorded = []
def captured_templates(app, recorded):
def record(sender, template, context):
recorded.append((template, context))
return template_rendered.connected_to(record, app)
The example above would then look like this::
templates = []
with captured_templates(app, templates):
...
template, context = templates[0]
.. admonition:: Blinker API Changes
The :meth:`~blinker.base.Signal.connected_to` method arrived in Blinker