merged with 0.5-maintenance
This commit is contained in:
commit
b004324dbb
3 changed files with 34 additions and 12 deletions
12
CHANGES
12
CHANGES
|
|
@ -8,10 +8,18 @@ Version 0.6
|
|||
|
||||
Release date to be announced, codename to be decided.
|
||||
|
||||
Version 0.5.1
|
||||
-------------
|
||||
|
||||
Bugfix Release, released on July 6th 2010
|
||||
|
||||
- fixes an issue with template loading from directories when modules
|
||||
where used.
|
||||
|
||||
Version 0.5
|
||||
-----------
|
||||
|
||||
Released on July 6th 2010, codename Calvados.
|
||||
Released on July 6th 2010, codename Calvados
|
||||
|
||||
- fixed a bug with subdomains that was caused by the inability to
|
||||
specify the server name. The server name can now be set with
|
||||
|
|
@ -53,7 +61,7 @@ Released on June 18th 2010, codename Rakia
|
|||
Version 0.3.1
|
||||
-------------
|
||||
|
||||
Bugfix release, released May 28th 2010
|
||||
Bugfix release, released on May 28th 2010
|
||||
|
||||
- fixed a error reporting bug with :meth:`flask.Config.from_envvar`
|
||||
- removed some unused code from flask
|
||||
|
|
|
|||
|
|
@ -34,21 +34,23 @@ class _DispatchingJinjaLoader(BaseLoader):
|
|||
self.app = app
|
||||
|
||||
def get_source(self, environment, template):
|
||||
name = template
|
||||
loader = None
|
||||
try:
|
||||
module, name = template.split('/', 1)
|
||||
loader = self.app.modules[module].jinja_loader
|
||||
if loader is None:
|
||||
raise ValueError()
|
||||
except (ValueError, KeyError):
|
||||
pass
|
||||
if loader is None:
|
||||
loader = self.app.jinja_loader
|
||||
try:
|
||||
return loader.get_source(environment, name)
|
||||
except TemplateNotFound:
|
||||
# re-raise the exception with the correct fileame here.
|
||||
# (the one that includes the prefix)
|
||||
raise TemplateNotFound(template)
|
||||
if loader is not None:
|
||||
return loader.get_source(environment, template)
|
||||
else:
|
||||
try:
|
||||
return loader.get_source(environment, name)
|
||||
except TemplateNotFound:
|
||||
pass
|
||||
# raise the exception with the correct fileame here.
|
||||
# (the one that includes the prefix)
|
||||
raise TemplateNotFound(template)
|
||||
|
||||
def list_templates(self):
|
||||
result = self.app.jinja_loader.list_templates()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ from contextlib import contextmanager
|
|||
from datetime import datetime
|
||||
from werkzeug import parse_date, parse_options_header
|
||||
from werkzeug.exceptions import NotFound
|
||||
from jinja2 import TemplateNotFound
|
||||
from cStringIO import StringIO
|
||||
|
||||
example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')
|
||||
|
|
@ -662,6 +663,17 @@ class ModuleTestCase(unittest.TestCase):
|
|||
assert flask.url_for('admin.static', filename='test.txt') \
|
||||
== '/admin/static/test.txt'
|
||||
|
||||
with app.test_request_context():
|
||||
try:
|
||||
flask.render_template('missing.html')
|
||||
except TemplateNotFound, e:
|
||||
assert e.name == 'missing.html'
|
||||
else:
|
||||
assert 0, 'expected exception'
|
||||
|
||||
with flask.Flask(__name__).test_request_context():
|
||||
assert flask.render_template('nested/nested.txt') == 'I\'m nested'
|
||||
|
||||
def test_safe_access(self):
|
||||
from moduleapp import app
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue