Fix blueprint self registration

By raising a ValueError if attempted. I don't see a use case that
makes this worth supporting.
This commit is contained in:
pgjones 2021-05-21 15:01:32 +01:00
parent 9409be6e34
commit 714b0a467a
2 changed files with 8 additions and 0 deletions

View file

@ -260,6 +260,8 @@ class Blueprint(Scaffold):
.. versionadded:: 2.0
"""
if blueprint is self:
raise ValueError("Cannot register a blueprint on itself")
self._blueprints.append((blueprint, options))
def register(self, app: "Flask", options: dict) -> None: