Modify comment syntax error

This commit is contained in:
wanghaha-dev 2022-11-04 23:37:34 +08:00
parent cc66213e57
commit 08cd375108
14 changed files with 24 additions and 24 deletions

View file

@ -1369,7 +1369,7 @@ Version 0.3.1
Released 2010-05-28
- Fixed a error reporting bug with ``Config.from_envvar``.
- Fixed an error reporting bug with ``Config.from_envvar``.
- Removed some unused code.
- Release does no longer include development leftover files (.git
folder for themes, built documentation in zip and pdf file and some

View file

@ -627,7 +627,7 @@ also makes it possible to use relative link targets safely.
You can also define multiple rules for the same function. They have to be
unique however. Defaults can also be specified. Here for example is a
definition for a URL that accepts an optional page::
definition for an URL that accepts an optional page::
@app.route('/users/', defaults={'page': 1})
@app.route('/users/page/<int:page>')
@ -637,7 +637,7 @@ definition for a URL that accepts an optional page::
This specifies that ``/users/`` will be the URL for page one and
``/users/page/N`` will be the URL for page ``N``.
If a URL contains a default value, it will be redirected to its simpler
If an URL contains a default value, it will be redirected to its simpler
form with a 301 redirect. In the above example, ``/users/page/1`` will
be redirected to ``/users/``. If your route handles ``GET`` and ``POST``
requests, make sure the default route only handles ``GET``, as redirects
@ -704,7 +704,7 @@ some defaults to :meth:`~flask.Flask.add_url_rule` or general behavior:
basis.
- `required_methods`: if this attribute is set, Flask will always add
these methods when registering a URL rule even if the methods were
these methods when registering an URL rule even if the methods were
explicitly overridden in the ``route()`` call.
Full example::

View file

@ -21,7 +21,7 @@ Blueprints in Flask are intended for these cases:
* Factor an application into a set of blueprints. This is ideal for
larger applications; a project could instantiate an application object,
initialize several extensions, and register a collection of blueprints.
* Register a blueprint on an application at a URL prefix and/or subdomain.
* Register a blueprint on an application at an URL prefix and/or subdomain.
Parameters in the URL prefix/subdomain become common view arguments
(with defaults) across all view functions in the blueprint.
* Register a blueprint multiple times on an application with different URL

View file

@ -127,7 +127,7 @@ each one.
- Configuration per application instance, through ``app.config``
values. This is configuration that could reasonably change for each
deployment of an application. A common example is a URL to an
deployment of an application. A common example is an URL to an
external resource, such as a database. Configuration keys should
start with the extension's name so that they don't interfere with
other extensions.

View file

@ -73,7 +73,7 @@ The simplest way to generate URLs is to continue to use
const user_url = {{ url_for("user", id=current_user.id)|tojson }}
fetch(user_url).then(...)
However, you might need to generate a URL based on information you only
However, you might need to generate an URL based on information you only
know in JavaScript. As discussed above, JavaScript runs in the user's
browser, not as part of the template rendering, so you can't use
``url_for`` at that point.
@ -97,7 +97,7 @@ when generating URLs from JavaScript.
Making a Request with ``fetch``
-------------------------------
|fetch|_ takes two arguments, a URL and an object with other options,
|fetch|_ takes two arguments, an URL and an object with other options,
and returns a |Promise|_. We won't cover all the available options, and
will only use ``then()`` on the promise, not other callbacks or
``await`` syntax. Read the linked MDN docs for more information about
@ -234,7 +234,7 @@ with the given data serialized to JSON.
It is usually not a good idea to return file data in a JSON response.
JSON cannot represent binary data directly, so it must be base64
encoded, which can be slow, takes more bandwidth to send, and is not as
easy to cache. Instead, serve files using one view, and generate a URL
easy to cache. Instead, serve files using one view, and generate an URL
to the desired file to include in the JSON. Then the client can make a
separate request to get the linked resource after getting the JSON.

View file

@ -160,7 +160,7 @@ Modern web applications use meaningful URLs to help users. Users are more
likely to like a page and come back if the page uses a meaningful URL they can
remember and use to directly visit a page.
Use the :meth:`~flask.Flask.route` decorator to bind a function to a URL. ::
Use the :meth:`~flask.Flask.route` decorator to bind a function to an URL. ::
@app.route('/')
def index():
@ -176,7 +176,7 @@ rules to a function.
Variable Rules
``````````````
You can add variable sections to a URL by marking sections with
You can add variable sections to an URL by marking sections with
``<variable_name>``. Your function then receives the ``<variable_name>``
as a keyword argument. Optionally, you can use a converter to specify the type
of the argument like ``<converter:variable_name>``. ::
@ -239,7 +239,7 @@ indexing the same page twice.
URL Building
````````````
To build a URL to a specific function, use the :func:`~flask.url_for` function.
To build an URL to a specific function, use the :func:`~flask.url_for` function.
It accepts the name of the function as its first argument and any number of
keyword arguments, each corresponding to a variable part of the URL rule.
Unknown variable parts are appended to the URL as query parameters.

View file

@ -93,7 +93,7 @@ would go to that page, their profiles would get deleted while they are
looking at images of fluffy cats.
How can you prevent that? Basically for each request that modifies
content on the server you would have to either use a one-time token and
content on the server you would have to either use an one-time token and
store that in the cookie **and** also transmit it with the form data.
After receiving the data on the server again, you would then have to
compare the two tokens and ensure they are equal.

View file

@ -260,7 +260,7 @@ an argument, ``id``. That corresponds to the ``<int:id>`` in the route.
A real URL will look like ``/1/update``. Flask will capture the ``1``,
ensure it's an :class:`int`, and pass it as the ``id`` argument. If you
don't specify ``int:`` and instead do ``<id>``, it will be a string.
To generate a URL to the update page, :func:`url_for` needs to be passed
To generate an URL to the update page, :func:`url_for` needs to be passed
the ``id`` so it knows what to fill in:
``url_for('blog.update', id=post['id'])``. This is also in the
``index.html`` file above.

View file

@ -7,7 +7,7 @@ A view function is the code you write to respond to requests to your
application. Flask uses patterns to match the incoming request URL to
the view that should handle it. The view returns data that Flask turns
into an outgoing response. Flask can also go the other direction and
generate a URL to a view based on its name and arguments.
generate an URL to a view based on its name and arguments.
Create a Blueprint

View file

@ -43,7 +43,7 @@ def create_app(test_config=None):
# make url_for('index') == url_for('blog.index')
# in another app, you might define a separate main index here with
# app.route, while giving the blog blueprint a url_prefix, but for
# app.route, while giving the blog blueprint an url_prefix, but for
# the tutorial the blog will be the main index
app.add_url_rule("/", endpoint="index")

View file

@ -1924,12 +1924,12 @@ class Flask(Scaffold):
_external: t.Optional[bool] = None,
**values: t.Any,
) -> str:
"""Generate a URL to the given endpoint with the given values.
"""Generate an URL to the given endpoint with the given values.
This is called by :func:`flask.url_for`, and can be called
directly as well.
An *endpoint* is the name of a URL rule, usually added with
An *endpoint* is the name of an URL rule, usually added with
:meth:`@app.route() <route>`, and usually the same name as the
view function. A route defined in a :class:`~flask.Blueprint`
will prepend the blueprint's name separated by a ``.`` to the
@ -1984,7 +1984,7 @@ class Flask(Scaffold):
else:
endpoint = endpoint[1:]
# When in a request, generate a URL without scheme and
# When in a request, generate an URL without scheme and
# domain by default, unless a scheme is given.
if _external is None:
_external = _scheme is not None
@ -2007,7 +2007,7 @@ class Flask(Scaffold):
" needed."
)
# When outside a request, generate a URL with scheme and
# When outside a request, generate an URL with scheme and
# domain by default.
if _external is None:
_external = True
@ -2195,7 +2195,7 @@ class Flask(Scaffold):
def create_url_adapter(
self, request: t.Optional[Request]
) -> t.Optional[MapAdapter]:
"""Creates a URL adapter for the given request. The URL adapter
"""Creates an URL adapter for the given request. The URL adapter
is created at a point where the request context is not yet set
up so the request is passed explicitly.

View file

@ -218,7 +218,7 @@ def url_for(
_external: t.Optional[bool] = None,
**values: t.Any,
) -> str:
"""Generate a URL to the given endpoint with the given values.
"""Generate an URL to the given endpoint with the given values.
This requires an active request or application context, and calls
:meth:`current_app.url_for() <flask.Flask.url_for>`. See that method

View file

@ -624,7 +624,7 @@ class Scaffold:
self,
f: T_url_value_preprocessor,
) -> T_url_value_preprocessor:
"""Register a URL value preprocessor function for all view
"""Register an URL value preprocessor function for all view
functions in the application. These functions will be called before the
:meth:`before_request` functions.

View file

@ -1346,7 +1346,7 @@ def test_url_generation(app, req_ctx):
def test_build_error_handler(app):
# Test base case, a URL which results in a BuildError.
# Test base case, an URL which results in a BuildError.
with app.test_request_context():
pytest.raises(BuildError, flask.url_for, "spam")