Move toggle for template caching into its own .ini flag.

This commit is contained in:
Max Goodman
2012-01-25 18:09:49 -08:00
parent 5a405f6b24
commit 8b5cad8687
4 changed files with 8 additions and 5 deletions

View File

@@ -8,8 +8,10 @@
# -- debug and configuation flags --
# global debug flag -- displays pylons stacktrace rather than 500 page on error when true
debug = true
# enables/disables template caching and whitespace removal (for development)
template_debug = true
# enables/disables whitespace removal (for development)
template_debug = false
# enables/disables compiled template caching and template file mtime checking
reload_templates = true
# use uncompressed static files (out of /static/js and /static/css)
# rather than compressed files out of /static (for development if true)
uncompressedJS = true

View File

@@ -68,7 +68,7 @@ def load_environment(global_conf={}, app_conf={}, setup_globals=True):
#tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format)
tmpl_options = config['buffet.template_options']
tmpl_options['mako.filesystem_checks'] = g.debug
tmpl_options['mako.filesystem_checks'] = getattr(g, 'reload_templates', False)
tmpl_options['mako.default_filters'] = ["mako_websafe"]
tmpl_options['mako.imports'] = \
["from r2.lib.filters import websafe, unsafe, mako_websafe",

View File

@@ -79,6 +79,7 @@ class Globals(object):
'log_start',
'sqlprinting',
'template_debug',
'reload_templates',
'uncompressedJS',
'enable_doquery',
'use_query_cache',

View File

@@ -175,11 +175,11 @@ class Templated(object):
from r2.config.templates import tpm
from pylons import g
debug = g.template_debug
use_cache = not g.reload_templates
template = None
try:
template = tpm.get(self.render_class,
style, cache = not debug)
style, cache = use_cache)
except AttributeError:
self._notfound(style)
return template