forked from orbit-oss/flask
Mention that people subscribe with **extra.
This commit is contained in:
parent
230e136f32
commit
174f32250e
1 changed files with 4 additions and 1 deletions
|
|
@ -55,7 +55,7 @@ to the template::
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def captured_templates(app):
|
def captured_templates(app):
|
||||||
recorded = []
|
recorded = []
|
||||||
def record(sender, template, context):
|
def record(sender, template, context, **extra):
|
||||||
recorded.append((template, context))
|
recorded.append((template, context))
|
||||||
template_rendered.connect(record, app)
|
template_rendered.connect(record, app)
|
||||||
try:
|
try:
|
||||||
|
|
@ -73,6 +73,9 @@ This can now easily be paired with a test client::
|
||||||
assert template.name == 'index.html'
|
assert template.name == 'index.html'
|
||||||
assert len(context['items']) == 10
|
assert len(context['items']) == 10
|
||||||
|
|
||||||
|
Make sure to subscribe with an extra ``**extra`` argument so that your
|
||||||
|
calls don't fail if Flask introduces new arguments to the signals.
|
||||||
|
|
||||||
All the template rendering in the code issued by the application `app`
|
All the template rendering in the code issued by the application `app`
|
||||||
in the body of the `with` block will now be recorded in the `templates`
|
in the body of the `with` block will now be recorded in the `templates`
|
||||||
variable. Whenever a template is rendered, the template object as well as
|
variable. Whenever a template is rendered, the template object as well as
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue