aboutsummaryrefslogtreecommitdiffstats
path: root/test/cache.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-06-23 16:12:57 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-06-23 16:12:57 +0000
commit78884f2fecc598bd8b35cdf8b4101b43d6b8af18 (patch)
tree636f44f419e94668c4eda39a8d388476eff53609 /test/cache.py
parenta136efc13700d33862da16a54e411ec27d3941af (diff)
downloadexternal_python_mako-78884f2fecc598bd8b35cdf8b4101b43d6b8af18.tar.gz
external_python_mako-78884f2fecc598bd8b35cdf8b4101b43d6b8af18.tar.bz2
external_python_mako-78884f2fecc598bd8b35cdf8b4101b43d6b8af18.zip
- cached blocks now use the current context when renderingrel_0_2_2
an expired section, instead of the original context passed in [ticket:87]
Diffstat (limited to 'test/cache.py')
-rw-r--r--test/cache.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cache.py b/test/cache.py
index e01359b..bff8c9e 100644
--- a/test/cache.py
+++ b/test/cache.py
@@ -320,6 +320,22 @@ class CacheTest(unittest.TestCase):
time.sleep(3)
x2 = t.render()
assert x1.strip() == x2.strip() == "foo"
+
+ def test_cache_uses_current_context(self):
+ t = Template("""
+ ${foo()}
+ <%def name="foo()" cached="True" cache_timeout="2">
+ foo: ${x}
+ </%def>
+ """)
+
+ import time
+ x1 = t.render(x=1)
+ time.sleep(3)
+ x2 = t.render(x=2)
+ assert x1.strip() == "foo: 1"
+ assert x2.strip() == "foo: 2"
+
def _install_mock_cache(self, template):
m = MockCache(template.module._template_cache)