Skip to content
Myr

Blueprint view function name should not contain dots

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

authored by Caratpine · committed by David Lord · parent 0a10908 · Browse files · 3 files+13 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+13 added−0 removed

  • tests:+9 added−0 removed
  • other:+4 added−0 removed

3 files+13 added−0 removed

modified:flask/blueprints.py+2 added
196 unmodified lines
197 the :func:`url_for` function is prefixed with the name of the blueprint.198 """199 if endpoint:200 assert '.' not in endpoint, "Blueprint endpoints should not contain dots"201 if view_func:202 assert '.' not in view_func.__name__, "Blueprint view function name should not contain dots"203 self.record(lambda s:204 s.add_url_rule(rule, endpoint, view_func, **options))205206 def endpoint(self, endpoint):
238 unmodified lines
modified:tests/test_blueprints.py+9 added
358 unmodified lines
359 bp.route('/bar/123', endpoint='bar.123'),360 lambda: None361 )362363 foo_foo_foo.__name__ = 'bar.123'364365 pytest.raises(366 AssertionError,367 lambda: bp.add_url_rule(368 '/bar/123', view_func=foo_foo_foo369 )370 )371372 app.register_blueprint(bp, url_prefix='/py')373374 assert client.get('/py/foo').data == b'bp.foo'375 # The rule's didn't actually made it through
454 unmodified lines
modified:CHANGES+2 added
110 unmodified lines
111 ``flask.app``. The level is only set on first access, it doesn't check112 ``app.debug`` each time. Only one format is used, not different ones113 depending on ``app.debug``. No handlers are removed, and a handler is only114 added if no handlers are already configured. (`#2436`_)115- Blueprint view function name may not contain dots. (`#2450`_)116117.. _#1421: https://github.com/pallets/flask/issues/1421118.. _#1489: https://github.com/pallets/flask/pull/1489119.. _#1621: https://github.com/pallets/flask/pull/1621
24 unmodified lines
144.. _#2414: https://github.com/pallets/flask/pull/2414145.. _#2416: https://github.com/pallets/flask/pull/2416146.. _#2430: https://github.com/pallets/flask/pull/2430147.. _#2436: https://github.com/pallets/flask/pull/2436148.. _#2450: https://github.com/pallets/flask/pull/2450149150Version 0.12.2151--------------152
617 unmodified lines