Skip to content
Myr

merged with 0.5-maintenance

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 · parents 3f7ab17, 0a93c55 · Browse files · 3 files+34 added−12 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+34 added−12 removed

  • tests:+12 added−0 removed
  • other:+22 added−12 removed

3 files+34 added−12 removed

modified:flask/templating.py+12 added-10 removed
32 unmodified lines
33 def __init__(self, app):34 self.app = app3536 def get_source(self, environment, template):37 name = template38 loader = None37 try:38 module, name = template.split('/', 1)39 loader = self.app.modules[module].jinja_loader40 if loader is None:41 raise ValueError()42 except (ValueError, KeyError):43 pass44 if loader is None:43 loader = self.app.jinja_loader46 try:47 return loader.get_source(environment, name)48 except TemplateNotFound:49 # re-raise the exception with the correct fileame here.50 # (the one that includes the prefix)51 raise TemplateNotFound(template)44 if loader is not None:45 return loader.get_source(environment, template)46 else:47 try:48 return loader.get_source(environment, name)49 except TemplateNotFound:50 pass51 # raise the exception with the correct fileame here.52 # (the one that includes the prefix)53 raise TemplateNotFound(template)5455 def list_templates(self):56 result = self.app.jinja_loader.list_templates()57 for name, module in self.app.modules.iteritems():
31 unmodified lines
modified:tests/flask_tests.py+12 added
19 unmodified lines
20from contextlib import contextmanager21from datetime import datetime22from werkzeug import parse_date, parse_options_header23from werkzeug.exceptions import NotFound24from jinja2 import TemplateNotFound25from cStringIO import StringIO2627example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')28sys.path.append(os.path.join(example_path, 'flaskr'))
633 unmodified lines
662 with app.test_request_context():663 assert flask.url_for('admin.static', filename='test.txt') \664 == '/admin/static/test.txt'665666 with app.test_request_context():667 try:668 flask.render_template('missing.html')669 except TemplateNotFound, e:670 assert e.name == 'missing.html'671 else:672 assert 0, 'expected exception'673674 with flask.Flask(__name__).test_request_context():675 assert flask.render_template('nested/nested.txt') == 'I\'m nested'676677 def test_safe_access(self):678 from moduleapp import app679680 with app.test_request_context():
280 unmodified lines
modified:CHANGES+10 added-2 removed
6 unmodified lines
7-----------89Release date to be announced, codename to be decided.1011Version 0.5.112-------------1314Bugfix Release, released on July 6th 20101516- fixes an issue with template loading from directories when modules17 where used.1819Version 0.520-----------2114Released on July 6th 2010, codename Calvados.22Released on July 6th 2010, codename Calvados2324- fixed a bug with subdomains that was caused by the inability to25 specify the server name. The server name can now be set with26 the `SERVER_NAME` config key. This key is now also used to set
33 unmodified lines
6061Version 0.3.162-------------6356Bugfix release, released May 28th 201064Bugfix release, released on May 28th 20106566- fixed a error reporting bug with :meth:`flask.Config.from_envvar`67- removed some unused code from flask68- release does no longer include development leftover files (.git
43 unmodified lines