Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 8b5cad8687c2249ac3d2ef019a2ced80347aa107 1 parent 5a405f6
Max Goodman authored
View
6 r2/example.ini
@@ -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
2  r2/r2/config/environment.py
@@ -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
1  r2/r2/lib/app_globals.py
@@ -79,6 +79,7 @@ class Globals(object):
'log_start',
'sqlprinting',
'template_debug',
+ 'reload_templates',
'uncompressedJS',
'enable_doquery',
'use_query_cache',
View
4 r2/r2/lib/wrapped.pyx
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.