Record blueprint registration order.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent 750ab16 · Browse files · 3 files·+14 added−3 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+14 added−3 removed
- other:+14 added−3 removed
Provenance
- Commit
c09a431- Tree
ccb648b- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
750ab16
3 files changed+14 added−3 removed
modified:flask/app.py+9 added
470 unmodified lines471 #: you how often they got attached.472 #:473 #: .. versionadded:: 0.7474 self.blueprints = {}475+ self._blueprint_order = []476 477 #: a place where extensions can store application specific state. For478 #: example this is where an extension could store database engines and479 #: similar things. For backwards compatibility extensions should register423 unmodified lines903 'are created on the fly need unique names.' % \904 (blueprint, self.blueprints[blueprint.name], blueprint.name)905 else:906 self.blueprints[blueprint.name] = blueprint907+ self._blueprint_order.append(blueprint)908 first_registration = True909 blueprint.register(self, options, first_registration)910 911+ def iter_blueprints(self):912+ """Iterates over all blueprints by the order they were registered.913+914+ .. versionadded:: 1.0915+ """916+ return iter(self._blueprint_order)917+918 @setupmethod919 def add_url_rule(self, rule, endpoint=None, view_func=None, **options):920 """Connects a URL rule. Works exactly like the :meth:`route`921 decorator. If a view_func is provided it will be registered with the968 unmodified linesmodified:flask/templating.py+2 added-3 removed
11 unmodified lines12 TemplateNotFound13 14 from .globals import _request_ctx_stack, _app_ctx_stack15 from .signals import template_rendered16-from ._compat import itervalues, iteritems16 17 18 def _default_template_ctx_processor():19 """Default template context processor. Injects `request`,59 unmodified lines79 loader = self.app.jinja_loader80 if loader is not None:81 yield self.app, loader82 84- for blueprint in itervalues(self.app.blueprints):83+ for blueprint in self.app.iter_blueprints():84 loader = blueprint.jinja_loader85 if loader is not None:86 yield blueprint, loader87 2 unmodified lines90 loader = self.app.jinja_loader91 if loader is not None:92 result.update(loader.list_templates())93 95- for name, blueprint in iteritems(self.app.blueprints):94+ for blueprint in self.app.iter_blueprints():95 loader = blueprint.jinja_loader96 if loader is not None:97 for template in loader.list_templates():98 result.add(template)40 unmodified linesmodified:CHANGES+3 added
42 unmodified lines43 - Removed deprecate module functionality.44 - Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when enabled will45 instruct Flask to explain how it locates templates. This should help46 users debug when the wrong templates are loaded.47+- Enforce blueprint handling in the order they were registered for template48+ loading.49 50+51 Version 0.10.252 --------------53 54 (bugfix release, release date to be announced)477 unmodified lines