fix: get back _blueprint_order, important for template searching
This commit is contained in:
parent
a960236117
commit
eda118964c
3 changed files with 8 additions and 1 deletions
|
|
@ -8,6 +8,10 @@ Unreleased
|
||||||
- Fix type annotation for ``teardown_request``. :issue:`4093`
|
- Fix type annotation for ``teardown_request``. :issue:`4093`
|
||||||
- Fix type annotation for ``before_request`` and ``before_app_request``
|
- Fix type annotation for ``before_request`` and ``before_app_request``
|
||||||
decorators. :issue:`4104`
|
decorators. :issue:`4104`
|
||||||
|
- Re-add the ``Flask._blueprint_order`` list. Take blueprint registration
|
||||||
|
order into consideration when searching for templates in
|
||||||
|
``DispatchingJinjaLoader._iter_loaders()``,
|
||||||
|
``DispatchingJinjaLoader.list_templates()``.
|
||||||
|
|
||||||
|
|
||||||
Version 2.0.1
|
Version 2.0.1
|
||||||
|
|
|
||||||
|
|
@ -463,6 +463,7 @@ class Flask(Scaffold):
|
||||||
#:
|
#:
|
||||||
#: .. versionadded:: 0.7
|
#: .. versionadded:: 0.7
|
||||||
self.blueprints: t.Dict[str, "Blueprint"] = {}
|
self.blueprints: t.Dict[str, "Blueprint"] = {}
|
||||||
|
self._blueprint_order: t.List[Blueprint] = []
|
||||||
|
|
||||||
#: a place where extensions can store application specific state. For
|
#: a place where extensions can store application specific state. For
|
||||||
#: example this is where an extension could store database engines and
|
#: example this is where an extension could store database engines and
|
||||||
|
|
@ -1035,7 +1036,7 @@ class Flask(Scaffold):
|
||||||
|
|
||||||
.. versionadded:: 0.11
|
.. versionadded:: 0.11
|
||||||
"""
|
"""
|
||||||
return self.blueprints.values()
|
return iter(self._blueprint_order)
|
||||||
|
|
||||||
@setupmethod
|
@setupmethod
|
||||||
def add_url_rule(
|
def add_url_rule(
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,8 @@ class Blueprint(Scaffold):
|
||||||
)
|
)
|
||||||
|
|
||||||
app.blueprints[name] = self
|
app.blueprints[name] = self
|
||||||
|
if self not in app._blueprint_order:
|
||||||
|
app._blueprint_order.append(self)
|
||||||
self._got_registered_once = True
|
self._got_registered_once = True
|
||||||
state = self.make_setup_state(app, options, first_registration)
|
state = self.make_setup_state(app, options, first_registration)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue