Browse Source

Alcoholified placeholders

pull/124/head
Armin Ronacher 15 years ago
parent
commit
20c2e53893
  1. 4
      docs/testing.rst
  2. 8
      flask.py

4
docs/testing.rst

@ -233,8 +233,8 @@ happen. With Flask 0.4 this is possible by using the
app = flask.Flask(__name__)
with app.test_client() as c:
rv = c.get('/?foo=42')
assert request.args['foo'] == '42'
rv = c.get('/?tequila=42')
assert request.args['tequila'] == '42'
If you would just be using the :meth:`~flask.Flask.test_client` without
the `with` block, the `assert` would fail with an error because `request`

8
flask.py

@ -213,7 +213,7 @@ def url_for(endpoint, **values):
def get_template_attribute(template_name, attribute):
"""Loads a macro (or variable) a template exports. This can be used to
invoke a macro from within Python code. If you for example have a
template named `_foo.html` with the following contents:
template named `_cider.html` with the following contents:
.. sourcecode:: html+jinja
@ -221,7 +221,7 @@ def get_template_attribute(template_name, attribute):
You can access this from Python code like this::
hello = get_template_attribute('_foo.html', 'hello')
hello = get_template_attribute('_cider.html', 'hello')
return hello('World')
.. versionadded:: 0.2
@ -1062,8 +1062,8 @@ class Flask(_PackageBoundObject):
you want to access the context locals for testing::
with app.test_client() as c:
rv = c.get('/?foo=42')
assert request.args['foo'] == '42'
rv = c.get('/?vodka=42')
assert request.args['vodka'] == '42'
.. versionchanged:: 0.4
added support for `with` block usage for the client.

Loading…
Cancel
Save