Skip to content

Commit

Permalink
Move toggle for template caching into its own .ini flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromakode committed Jan 31, 2012
1 parent 5a405f6 commit 8b5cad8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions r2/example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion r2/r2/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions r2/r2/lib/app_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Globals(object):
'log_start',
'sqlprinting',
'template_debug',
'reload_templates',
'uncompressedJS',
'enable_doquery',
'use_query_cache',
Expand Down
4 changes: 2 additions & 2 deletions r2/r2/lib/wrapped.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8b5cad8

Please sign in to comment.