Skip to content
Myr

Merge pull request #162 from mgax/fix-caching

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

fix DictLoader `uptodate` callback

authored by Armin Ronacher · committed by Armin Ronacher · parents 0a6f850, 85b9c8a · Browse files · 2 files+8 added−1 removed
This commit

State

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

Diff stats

2 files+8 added−1 removed

  • other:+8 added−1 removed

2 files+8 added−1 removed

modified:jinja2/testsuite/loader.py+7 added
91 unmodified lines
92 assert 'one' in env.cache93 assert 'two' not in env.cache94 assert 'three' in env.cache9596 def test_dict_loader_cache_invalidates(self):97 mapping = {'foo': "one"}98 env = Environment(loader=loaders.DictLoader(mapping))99 assert env.get_template('foo').render() == "one"100 mapping['foo'] = "two"101 assert env.get_template('foo').render() == "two"102103 def test_split_template_path(self):104 assert split_template_path('foo/bar') == ['foo', 'bar']105 assert split_template_path('./foo/bar') == ['foo', 'bar']106 self.assert_raises(TemplateNotFound, split_template_path, '../foo')
119 unmodified lines
modified:jinja2/loaders.py+1 added-1 removed
273 unmodified lines
274275 def get_source(self, environment, template):276 if template in self.mapping:277 source = self.mapping[template]278 return source, None, lambda: source != self.mapping.get(template)278 return source, None, lambda: source == self.mapping.get(template)279 raise TemplateNotFound(template)280281 def list_templates(self):282 return sorted(self.mapping)
192 unmodified lines