Skip to content
Myr

Fixed a template loading bug

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 793a56b · Browse files · 1 file+6 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−9 removed

  • other:+6 added−9 removed

1 file+6 added−9 removed

modified:flask/templating.py+6 added-9 removed
33 unmodified lines
34 def __init__(self, app):35 self.app = app3637 def get_source(self, environment, template):38 loader = None39 try:40 module, name = template.split('/', 1)41 loader = self.app.modules[module].jinja_loader41 if loader is None:42 raise ValueError()42 except (ValueError, KeyError):44 loader = self.app.jinja_loader45 if loader is not None:46 return loader.get_source(environment, template)47 else:43 pass44 # if there was a module and it has a loader, try this first45 if loader is not None:46 try:47 return loader.get_source(environment, name)48 except TemplateNotFound:49 pass52 # raise the exception with the correct filename here.53 # (the one that includes the prefix)54 raise TemplateNotFound(template)50 # fall back to application loader if module failed51 return self.app.jinja_loader.get_source(environment, template)5253 def list_templates(self):54 result = self.app.jinja_loader.list_templates()55 for name, module in self.app.modules.iteritems():
31 unmodified lines