aboutsummaryrefslogtreecommitdiffstats
path: root/mako/runtime.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-10-01 17:55:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-10-01 17:55:59 -0400
commit643701f1d30e1af70dbd4e99cf8e3b9517f74561 (patch)
tree7470dcb58bff8288b161598f2132773f610c66d2 /mako/runtime.py
parent5cd508ffe0d7eaadd6516fc35137c93d1d6577a9 (diff)
downloadexternal_python_mako-643701f1d30e1af70dbd4e99cf8e3b9517f74561.tar.gz
external_python_mako-643701f1d30e1af70dbd4e99cf8e3b9517f74561.tar.bz2
external_python_mako-643701f1d30e1af70dbd4e99cf8e3b9517f74561.zip
- Template caching has been converted into a plugin
system, whereby the usage of Beaker is just the default plugin. Template and TemplateLookup now accept a string "cache_impl" parameter which refers to the name of a cache plugin, defaulting to the name 'beaker'. New plugins can be registered as pkg_resources entrypoints under the group "mako.cache", or registered directly using mako.cache.register_plugin(). The core plugin is the mako.cache.CacheImpl class. - The <%def>, <%block> and <%page> tags now accept any argument named "cache_*", and the key minus the "cache_" prefix will be passed as keyword arguments to the CacheImpl methods. - Template and TemplateLookup now accept an argument cache_args, which refers to a dictionary containing cache parameters. The cache_dir, cache_url, cache_type, cache_timeout arguments are deprecated (will probably never be removed, however) and can be passed now as cache_args={'url':<some url>, 'type':'memcached', 'timeout':50, 'dir':'/path/to/some/directory'}
Diffstat (limited to 'mako/runtime.py')
-rw-r--r--mako/runtime.py18
1 files changed, 2 insertions, 16 deletions
diff --git a/mako/runtime.py b/mako/runtime.py
index dfd701a..6236b14 100644
--- a/mako/runtime.py
+++ b/mako/runtime.py
@@ -330,27 +330,13 @@ class Namespace(object):
by ``<%page>``.
"""
-
- if self.template:
- if not self.template.cache_enabled:
- createfunc = kwargs.get('createfunc', None)
- if createfunc:
- return createfunc()
- else:
- return None
-
- if self.template.cache_dir:
- kwargs.setdefault('data_dir', self.template.cache_dir)
- if self.template.cache_type:
- kwargs.setdefault('type', self.template.cache_type)
- if self.template.cache_url:
- kwargs.setdefault('url', self.template.cache_url)
+
return self.cache.get(key, **kwargs)
@property
def cache(self):
"""Return the :class:`.Cache` object referenced
- by this :class:`.Namespace` object's
+ by this :class:`.Namespace` object's
:class:`.Template`.
"""