Skip to content
Myr

Merge pull request #2729 from Dunstrom/2601-internal-error-when-requesting-route-with-url-part-equals-defaults

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Added short note about Werkzeug redirect behaviour

authored by David Lord · committed by GitHub · parents 78b56db, 5d00869 · Browse files · 1 file+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−1 removed

  • other:+12 added−1 removed

1 file+12 added−1 removed

modified:docs/api.rst+12 added-1 removed
715 unmodified lines
716 def show_users(page):717 pass718719This specifies that ``/users/`` will be the URL for page one and720``/users/page/N`` will be the URL for page `N`.720``/users/page/N`` will be the URL for page ``N``.721722If a URL contains a default value, it will be redirected to its simpler723form with a 301 redirect. In the above example, ``/users/page/1`` will724be redirected to ``/users/``. If your route handles ``GET`` and ``POST``725requests, make sure the default route only handles ``GET``, as redirects726can't preserve form data. ::727728 @app.route('/region/', defaults={'id': 1})729 @app.route('/region/<id>', methods=['GET', 'POST'])730 def region(id):731 pass732733Here are the parameters that :meth:`~flask.Flask.route` and734:meth:`~flask.Flask.add_url_rule` accept. The only difference is that735with the route parameter the view function is defined with the decorator736instead of the `view_func` parameter.
97 unmodified lines