Hackfut Security File Manager
Current Path:
/opt/alt/python27/lib/python2.7/site-packages/mako/ext
opt
/
alt
/
python27
/
lib
/
python2.7
/
site-packages
/
mako
/
ext
/
📁
..
📄
__init__.py
(0 B)
📄
__init__.pyc
(153 B)
📄
__init__.pyo
(153 B)
📄
autohandler.py
(1.8 KB)
📄
autohandler.pyc
(1.78 KB)
📄
autohandler.pyo
(1.78 KB)
📄
babelplugin.py
(5.4 KB)
📄
babelplugin.pyc
(4.33 KB)
📄
babelplugin.pyo
(4.33 KB)
📄
beaker_cache.py
(2.34 KB)
📄
beaker_cache.pyc
(3.16 KB)
📄
beaker_cache.pyo
(3.16 KB)
📄
preprocessors.py
(586 B)
📄
preprocessors.pyc
(701 B)
📄
preprocessors.pyo
(701 B)
📄
pygmentplugin.py
(4.43 KB)
📄
pygmentplugin.pyc
(5.57 KB)
📄
pygmentplugin.pyo
(5.58 KB)
📄
turbogears.py
(2.07 KB)
📄
turbogears.pyc
(2.11 KB)
📄
turbogears.pyo
(2.11 KB)
Editing: beaker_cache.py
"""Provide a :class:`.CacheImpl` for the Beaker caching system.""" from mako import exceptions from mako.cache import CacheImpl _beaker_cache = None class BeakerCacheImpl(CacheImpl): """A :class:`.CacheImpl` provided for the Beaker caching system. This plugin is used by default, based on the default value of ``'beaker'`` for the ``cache_impl`` parameter of the :class:`.Template` or :class:`.TemplateLookup` classes. """ def __init__(self, cache): global _beaker_cache if _beaker_cache is None: try: from beaker import cache as beaker_cache except ImportError, e: raise exceptions.RuntimeException( "the Beaker package is required to use cache " "functionality.") if 'manager' in cache.template.cache_args: _beaker_cache = cache.template.cache_args['manager'] else: _beaker_cache = beaker_cache.CacheManager() super(BeakerCacheImpl, self).__init__(cache) def _get_cache(self, **kw): expiretime = kw.pop('timeout', None) if 'dir' in kw: kw['data_dir'] = kw.pop('dir') elif self.cache.template.module_directory: kw['data_dir'] = self.cache.template.module_directory if 'manager' in kw: kw.pop('manager') if kw.get('type') == 'memcached': kw['type'] = 'ext:memcached' if 'region' in kw: region = kw.pop('region') cache = _beaker_cache.get_cache_region(self.cache.id, region, **kw) else: cache = _beaker_cache.get_cache(self.cache.id, **kw) cache_args = {'starttime':self.cache.starttime} if expiretime: cache_args['expiretime'] = expiretime return cache, cache_args def get_or_create(self, key, creation_function, **kw): cache, kw = self._get_cache(**kw) return cache.get(key, createfunc=creation_function, **kw) def put(self, key, value, **kw): cache, kw = self._get_cache(**kw) cache.put(key, value, **kw) def get(self, key, **kw): cache, kw = self._get_cache(**kw) return cache.get(key, **kw) def invalidate(self, key, **kw): cache, kw = self._get_cache(**kw) cache.remove_value(key, **kw)
Upload File
Create Folder