Skip to content
Myr

fix DictLoader `uptodate` callback

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

authored by Alex Morega · committed by Alex Morega · parent 21a2010 · 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
272 unmodified lines
273274 def get_source(self, environment, template):275 if template in self.mapping:276 source = self.mapping[template]277 return source, None, lambda: source != self.mapping.get(template)277 return source, None, lambda: source == self.mapping.get(template)278 raise TemplateNotFound(template)279280 def list_templates(self):281 return sorted(self.mapping)
192 unmodified lines