forked from orbit-oss/flask
Provide ways to override the url rule
This commit is contained in:
parent
26e748cdd3
commit
0e98a08097
1 changed files with 7 additions and 1 deletions
|
|
@ -200,6 +200,12 @@ class Flask(_PackageBoundObject):
|
||||||
'MAX_CONTENT_LENGTH': None
|
'MAX_CONTENT_LENGTH': None
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#: The rule object to use for URL rules created. This is used by
|
||||||
|
#: :meth:`add_url_rule`. Defaults to :class:`werkzeug.routing.Rule`.
|
||||||
|
#:
|
||||||
|
#: .. versionadded:: 0.7
|
||||||
|
url_rule_class = Rule
|
||||||
|
|
||||||
#: the test client that is used with when `test_client` is used.
|
#: the test client that is used with when `test_client` is used.
|
||||||
#:
|
#:
|
||||||
#: .. versionadded:: 0.7
|
#: .. versionadded:: 0.7
|
||||||
|
|
@ -573,7 +579,7 @@ class Flask(_PackageBoundObject):
|
||||||
if 'OPTIONS' not in methods:
|
if 'OPTIONS' not in methods:
|
||||||
methods = tuple(methods) + ('OPTIONS',)
|
methods = tuple(methods) + ('OPTIONS',)
|
||||||
provide_automatic_options = True
|
provide_automatic_options = True
|
||||||
rule = Rule(rule, methods=methods, **options)
|
rule = self.url_rule_class(rule, methods=methods, **options)
|
||||||
rule.provide_automatic_options = provide_automatic_options
|
rule.provide_automatic_options = provide_automatic_options
|
||||||
self.url_map.add(rule)
|
self.url_map.add(rule)
|
||||||
if view_func is not None:
|
if view_func is not None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue