remove _blueprint_order, dicts are ordered

This code originates from supporting Python 2.4. Dicts are ordered in
supported Pythons as of 3.6. An OrderedDict could be used to indicate
that order matters, but is not since we don't rely on the implementation
differences.
This commit is contained in:
pgjones 2021-02-23 20:19:53 +00:00 committed by David Lord
parent fd62210f58
commit 83d358d2c4
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8

View file

@ -430,13 +430,13 @@ class Flask(Scaffold):
#: .. versionadded:: 0.11
self.shell_context_processors = []
#: all the attached blueprints in a dictionary by name. Blueprints
#: can be attached multiple times so this dictionary does not tell
#: you how often they got attached.
#: Maps registered blueprint names to blueprint objects. The
#: dict retains the order the blueprints were registered in.
#: Blueprints can be registered multiple times, this dict does
#: not track how often they were attached.
#:
#: .. versionadded:: 0.7
self.blueprints = {}
self._blueprint_order = []
#: a place where extensions can store application specific state. For
#: example this is where an extension could store database engines and
@ -997,7 +997,6 @@ class Flask(Scaffold):
)
else:
self.blueprints[blueprint.name] = blueprint
self._blueprint_order.append(blueprint)
first_registration = True
blueprint.register(self, options, first_registration)
@ -1007,7 +1006,7 @@ class Flask(Scaffold):
.. versionadded:: 0.11
"""
return iter(self._blueprint_order)
return self.blueprints.values()
@setupmethod
def add_url_rule(