Browse Source

Provide ways to override the url rule

pull/245/merge
Armin Ronacher 14 years ago
parent
commit
0e98a08097
  1. 8
      flask/app.py

8
flask/app.py

@ -200,6 +200,12 @@ class Flask(_PackageBoundObject):
'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.
#:
#: .. versionadded:: 0.7
@ -573,7 +579,7 @@ class Flask(_PackageBoundObject):
if 'OPTIONS' not in methods:
methods = tuple(methods) + ('OPTIONS',)
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
self.url_map.add(rule)
if view_func is not None:

Loading…
Cancel
Save