Skip to content
Myr

Add additional information in the url_rule docs (#2467)

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

If a user is making use of the errorhandler(405) decorator, and they wish to include an Allow header (as per HTTP spec), they may be confused to find that url_rule is None. This doc change aims to clarify that because the request was never successfully matched, it was never bound to a URL rule and to access the valid methods, they must examine routing_exception.

authored by Henry Chladil · committed by Adrian · parent 7e4e6ec · Browse files · 1 file+4 added−0 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+4 added−0 removed

  • other:+4 added−0 removed

1 file+4 added−0 removed

modified:flask/wrappers.py+4 added
117 unmodified lines
118119 #: The internal URL rule that matched the request. This can be120 #: useful to inspect which methods are allowed for the URL from121 #: a before/after handler (``request.url_rule.methods``) etc.122 #: Though if the request's method was invalid for the URL rule,123 #: the valid list is available in ``routing_exception.valid_methods``124 #: instead (an attribute of the Werkzeug exception :exc:`~werkzeug.exceptions.MethodNotAllowed`)125 #: because the request was never internally bound. 126 #:127 #: .. versionadded:: 0.6128 url_rule = None129
65 unmodified lines