Skip to content
Myr

Merge pull request #5014 from evgenymozhaev/require-a-non-empty-name-for-blueprints

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

Require a non empty name for blueprints

authored by David Lord · committed by GitHub · parents 7ee9ceb, b8b4100 · Browse files · 3 files+10 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+10 added−0 removed

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

3 files+10 added−0 removed

modified:src/flask/blueprints.py+3 added
188 unmodified lines
189 template_folder=template_folder,190 root_path=root_path,191 )192193 if not name:194 raise ValueError("'name' may not be empty.")195196 if "." in name:197 raise ValueError("'name' may not contain a dot '.' character.")198199 self.name = name
425 unmodified lines
modified:tests/test_blueprints.py+5 added
254 unmodified lines
255 with pytest.raises(ValueError):256 flask.Blueprint("app.ui", __name__)257258259def test_empty_name_not_allowed(app, client):260 with pytest.raises(ValueError):261 flask.Blueprint("", __name__)262263264def test_dotted_names_from_app(app, client):265 test = flask.Blueprint("test", __name__)266267 @app.route("/")
786 unmodified lines
modified:CHANGES.rst+2 added
33 unmodified lines
34 :pr:`4947`35- Ensure subdomains are applied with nested blueprints. :issue:`4834`36- ``config.from_file`` can use ``text=False`` to indicate that the parser wants a37 binary file instead. :issue:`4989`38- If a blueprint is created with an empty name it raises a ``ValueError``.39 :issue:`5010`404142Version 2.2.443-------------
1423 unmodified lines