From 0e98a080976f39e20aa6f18e8a335aa23d9334f7 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sat, 25 Jun 2011 12:26:07 +0200 Subject: [PATCH] Provide ways to override the url rule --- flask/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flask/app.py b/flask/app.py index 1e068e41..c7b287a6 100644 --- a/flask/app.py +++ b/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: