Fixed template_rendered example in signal documentation.
This commit is contained in:
parent
a3f78af870
commit
36a421bb3a
1 changed files with 3 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ to the template::
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def captured_templates(app):
|
def captured_templates(app):
|
||||||
recorded = []
|
recorded = []
|
||||||
def record(template, context):
|
def record(sender, template, context):
|
||||||
recorded.append((template, context))
|
recorded.append((template, context))
|
||||||
template_rendered.connect(record, app)
|
template_rendered.connect(record, app)
|
||||||
try:
|
try:
|
||||||
|
|
@ -87,7 +87,7 @@ its own which simplifies the example above::
|
||||||
|
|
||||||
def captured_templates(app):
|
def captured_templates(app):
|
||||||
recorded = []
|
recorded = []
|
||||||
def record(template, context):
|
def record(sender, template, context):
|
||||||
recorded.append((template, context))
|
recorded.append((template, context))
|
||||||
return template_rendered.connected_to(record, app)
|
return template_rendered.connected_to(record, app)
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ With Blinker 1.1 you can also easily subscribe to signals by using the new
|
||||||
from flask import template_rendered
|
from flask import template_rendered
|
||||||
|
|
||||||
@template_rendered.connect_via(app)
|
@template_rendered.connect_via(app)
|
||||||
def when_template_rendered(template, context):
|
def when_template_rendered(sender, template, context):
|
||||||
print 'Template %s is rendered with %s' % (template.name, context)
|
print 'Template %s is rendered with %s' % (template.name, context)
|
||||||
|
|
||||||
Core Signals
|
Core Signals
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue