Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a documentation error. This fixes #143

  • Loading branch information...
commit 2ac1b7d4388209d8e1309ed5b43ebe8d023eaa53 1 parent 858806d
@mitsuhiko authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 docs/signals.rst
View
13 docs/signals.rst
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.