Skip to content
Permalink
Browse files
Use cache folder inside cache/
  • Loading branch information
ralsina committed Dec 18, 2015
1 parent fc99b38 commit ec5fc6bc2fd899f2f268addffecfef8c1d92fb2a
Showing with 8 additions and 8 deletions.
  1. +8 −8 nikola/plugins/template/jinja.py
@@ -52,21 +52,21 @@ def __init__(self):
"""Initialize Jinja2 environment with extended set of filters."""
if jinja2 is None:
return
# Not ideal because it's not using our cache structure
# but we don't have that folder at init time
cache = jinja2.FileSystemBytecodeCache()

def set_directories(self, directories, cache_folder):
"""Create a new template lookup with set directories."""
if jinja2 is None:
req_missing(['jinja2'], 'use this theme')
cache_folder = os.path.join(cache_folder, 'jinja')
makedirs(cache_folder)
cache = jinja2.FileSystemBytecodeCache(cache_folder)
self.lookup = jinja2.Environment(bytecode_cache=cache)
self.lookup.trim_blocks = True
self.lookup.lstrip_blocks = True
self.lookup.filters['tojson'] = json.dumps
self.lookup.globals['enumerate'] = enumerate
self.lookup.globals['isinstance'] = isinstance
self.lookup.globals['tuple'] = tuple

def set_directories(self, directories, cache_folder):
"""Create a new template lookup with set directories."""
if jinja2 is None:
req_missing(['jinja2'], 'use this theme')
self.directories = directories
self.create_lookup()

0 comments on commit ec5fc6b

Please sign in to comment.