forked from orbit-oss/flask
split code and output
This commit is contained in:
parent
393bd46085
commit
0b7a74dda3
1 changed files with 10 additions and 5 deletions
|
|
@ -277,7 +277,9 @@ Why would you want to build URLs using the URL reversing function
|
||||||
For example, here we use the :meth:`~flask.Flask.test_request_context` method
|
For example, here we use the :meth:`~flask.Flask.test_request_context` method
|
||||||
to try out :func:`~flask.url_for`. :meth:`~flask.Flask.test_request_context`
|
to try out :func:`~flask.url_for`. :meth:`~flask.Flask.test_request_context`
|
||||||
tells Flask to behave as though it's handling a request even while we use a
|
tells Flask to behave as though it's handling a request even while we use a
|
||||||
Python shell. See :ref:`context-locals`. ::
|
Python shell. See :ref:`context-locals`.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
from flask import Flask, url_for
|
from flask import Flask, url_for
|
||||||
|
|
||||||
|
|
@ -301,10 +303,13 @@ Python shell. See :ref:`context-locals`. ::
|
||||||
print(url_for('login', next='/'))
|
print(url_for('login', next='/'))
|
||||||
print(url_for('profile', username='John Doe'))
|
print(url_for('profile', username='John Doe'))
|
||||||
|
|
||||||
# /
|
.. code-block:: text
|
||||||
# /login
|
|
||||||
# /login?next=/
|
/
|
||||||
# /user/John%20Doe
|
/login
|
||||||
|
/login?next=/
|
||||||
|
/user/John%20Doe
|
||||||
|
|
||||||
|
|
||||||
HTTP Methods
|
HTTP Methods
|
||||||
````````````
|
````````````
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue