From 264d52f6c58130d1c1243b54c18f0dca5f1cb183 Mon Sep 17 00:00:00 2001 From: pgjones Date: Tue, 23 Feb 2021 20:19:53 +0000 Subject: [PATCH] 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. --- src/flask/app.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/flask/app.py b/src/flask/app.py index 7fc79546..496732ec 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -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(