diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-11 19:25:46 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-11 19:25:46 -0500 |
commit | 3266c0160d9103703400123b81a713db21ccd5be (patch) | |
tree | 91ca2ddb97ef2479ede46c11f579892b1cf66ebc | |
parent | 2bdec394ff76a9b84fc35e8b0e9a20f175f9b8a4 (diff) | |
download | mako-3266c0160d9103703400123b81a713db21ccd5be.tar.gz |
propagate cache_impl from lookup to template , #179
-rw-r--r-- | mako/lookup.py | 1 | ||||
-rw-r--r-- | test/test_cache.py | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/mako/lookup.py b/mako/lookup.py index c2fb034..e35fe10 100644 --- a/mako/lookup.py +++ b/mako/lookup.py @@ -191,6 +191,7 @@ class TemplateLookup(TemplateCollection): 'disable_unicode':disable_unicode, 'bytestring_passthrough':bytestring_passthrough, 'output_encoding':output_encoding, + 'cache_impl':cache_impl, 'encoding_errors':encoding_errors, 'input_encoding':input_encoding, 'module_directory':module_directory, diff --git a/test/test_cache.py b/test/test_cache.py index aba204c..d898b02 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -392,7 +392,18 @@ class CacheTest(TemplateTest): %> """) assert result_lines(t.render()) == ['foo: 1', 'foo: 1', 'foo: 3', 'foo: 3'] - + + def test_lookup(self): + l = TemplateLookup(cache_impl='mock') + l.put_string("x", """ + <%page cached="True" /> + ${y} + """) + t = l.get_template("x") + assert result_lines(t.render(y=5)) == ["5"] + assert result_lines(t.render(y=7)) == ["5"] + assert isinstance(t.cache.impl, MockCacheImpl) + def test_invalidate(self): t = Template(""" <%%def name="foo()" cached="True"> |