summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 11:18:59 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2013-05-19 11:18:59 +0100
commit8dc9d4d6cb6bbfd3bee9d32cc25fb294dc60cd78 (patch)
treefabb1748f41f6c90ece8e02c2f8b24275d5e4c3b
parenta65f1eb9065d78fcd0b4871782bbe008b5f8ab7b (diff)
parent83f6a6891212b4a169346b1454801e296dc7cd66 (diff)
downloadjinja2-8dc9d4d6cb6bbfd3bee9d32cc25fb294dc60cd78.tar.gz
Merge branch 'master' of github.com:mitsuhiko/jinja2
-rw-r--r--docs/templates.rst2
-rw-r--r--jinja2/loaders.py2
-rw-r--r--jinja2/testsuite/loader.py7
3 files changed, 9 insertions, 2 deletions
diff --git a/docs/templates.rst b/docs/templates.rst
index 6c8eee3..c60b27f 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -830,7 +830,7 @@ default. For more details about context behavior of imports and includes
see :ref:`import-visibility`.
From Jinja 2.2 onwards you can mark an include with ``ignore missing`` in
-which case Jinja will ignore the statement if the template to be ignored
+which case Jinja will ignore the statement if the template to be included
does not exist. When combined with ``with`` or ``without context`` it has
to be placed *before* the context visibility statement. Here some valid
examples::
diff --git a/jinja2/loaders.py b/jinja2/loaders.py
index 08fe872..f8e4f99 100644
--- a/jinja2/loaders.py
+++ b/jinja2/loaders.py
@@ -275,7 +275,7 @@ class DictLoader(BaseLoader):
def get_source(self, environment, template):
if template in self.mapping:
source = self.mapping[template]
- return source, None, lambda: source != self.mapping.get(template)
+ return source, None, lambda: source == self.mapping.get(template)
raise TemplateNotFound(template)
def list_templates(self):
diff --git a/jinja2/testsuite/loader.py b/jinja2/testsuite/loader.py
index f62ec92..9368698 100644
--- a/jinja2/testsuite/loader.py
+++ b/jinja2/testsuite/loader.py
@@ -93,6 +93,13 @@ class LoaderTestCase(JinjaTestCase):
assert 'two' not in env.cache
assert 'three' in env.cache
+ def test_dict_loader_cache_invalidates(self):
+ mapping = {'foo': "one"}
+ env = Environment(loader=loaders.DictLoader(mapping))
+ assert env.get_template('foo').render() == "one"
+ mapping['foo'] = "two"
+ assert env.get_template('foo').render() == "two"
+
def test_split_template_path(self):
assert split_template_path('foo/bar') == ['foo', 'bar']
assert split_template_path('./foo/bar') == ['foo', 'bar']