Skip to content
Myr

Worked around a werkzeug bug with redirects

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 c26a6dd · Browse files · 3 files+22 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

3 files+22 added−0 removed

  • tests:+15 added−0 removed
  • other:+7 added−0 removed

3 files+22 added−0 removed

modified:flask/app.py+6 added
704 unmodified lines
705 provide_automatic_options = False706 if 'OPTIONS' not in methods:707 methods = tuple(methods) + ('OPTIONS',)708 provide_automatic_options = True709710 # due to a werkzeug bug we need to make sure that the defaults are711 # None if they are an empty dictionary. This should not be necessary712 # with Werkzeug 0.7713 options['defaults'] = options.get('defaults') or None714715 rule = self.url_rule_class(rule, methods=methods, **options)716 rule.provide_automatic_options = provide_automatic_options717 self.url_map.add(rule)718 if view_func is not None:
588 unmodified lines
modified:tests/flask_tests.py+15 added
1362 unmodified lines
1363 self.assertEqual(c.get('/fe').data.strip(), '/be')1364 self.assertEqual(c.get('/fe2').data.strip(), '/fe')1365 self.assertEqual(c.get('/be').data.strip(), '/fe')13661367 def test_empty_url_defaults(self):1368 bp = flask.Blueprint('bp', __name__)13691370 @bp.route('/', defaults={'page': 1})1371 @bp.route('/page/<int:page>')1372 def something(page):1373 return str(page)13741375 app = flask.Flask(__name__)1376 app.register_blueprint(bp)13771378 c = app.test_client()1379 self.assertEqual(c.get('/').data, '1')1380 self.assertEqual(c.get('/page/2').data, '2')138113821383class SendfileTestCase(unittest.TestCase):13841385 def test_send_file_regular(self):1386 app = flask.Flask(__name__)
506 unmodified lines
modified:CHANGES+1 added
7 unmodified lines
89Bugfix release, release date to be decided.1011- Added missing future import that broke 2.5 compatibility.12- Fixed an infinite redirect issue with blueprints.1314Version 0.715-----------16
214 unmodified lines