Skip to content
Myr

Flask no longer internally depends on rules being added through the add_url_rule function

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 07688d7 · Browse files · 3 files+23 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

3 files+23 added−1 removed

  • tests:+18 added−0 removed
  • other:+5 added−1 removed

3 files+23 added−1 removed

modified:flask/app.py+2 added-1 removed
728 unmodified lines
729 raise req.routing_exception730 rule = req.url_rule731 # if we provide automatic options for this URL and the732 # request came with the OPTIONS method, reply automatically733 if rule.provide_automatic_options and req.method == 'OPTIONS':733 if getattr(rule, 'provide_automatic_options', False) \734 and req.method == 'OPTIONS':735 return self.make_default_options_response()736 # otherwise dispatch to the handler for that endpoint737 return self.view_functions[rule.endpoint](**req.view_args)738 except HTTPException, e:
210 unmodified lines
modified:tests/flask_tests.py+18 added
204 unmodified lines
205 rv = c.delete('/more')206 assert rv.status_code == 405207 assert sorted(rv.allow) == ['GET', 'HEAD', 'OPTIONS', 'POST']208209 def test_werkzeug_routing(self):210 from werkzeug.routing import Submount, Rule211 app = flask.Flask(__name__)212 app.url_map.add(Submount('/foo', [213 Rule('/bar', endpoint='bar'),214 Rule('/', endpoint='index')215 ]))216 def bar():217 return 'bar'218 def index():219 return 'index'220 app.view_functions['bar'] = bar221 app.view_functions['index'] = index222223 c = app.test_client()224 assert c.get('/foo/').data == 'index'225 assert c.get('/foo/bar').data == 'bar'226227 def test_session(self):228 app = flask.Flask(__name__)229 app.secret_key = 'testkey'230 @app.route('/set', methods=['POST'])
1212 unmodified lines
modified:CHANGES+3 added
25 unmodified lines
26- added a `PROPAGATE_EXCEPTIONS` configuration variable that can be27 used to flip the setting of exception propagation which previously28 was linked to `DEBUG` alone and is now linked to either `DEBUG` or29 `TESTING`.30- Flask no longer internally depends on rules being added through the31 `add_url_rule` function and can now also accept regular werkzeug32 rules added to the url map.3334Version 0.6.135-------------36
159 unmodified lines