On Tue, 2010-11-16 at 05:14 -0800, Alexander Zhabotinskiy wrote:
> My project has 2 "heavy loaded" templates with a lot of dynamicly
> generated data (sqlalchemy query-cycles, generated JS etc.).
>
> Sometimes, users working with this templates, getting an wrong
> rendering in this templates (the part of another-user data, or even
> another rendered pages)
>
> Is it possible to fully disable mako templates caching in Pylons 1.0
> like cache_enabled = F/false (not worked in 1.0)
I've also wondered what the "proper" way might be to do this. Here's
what I've done as a workaround in the meantime in config/environment.py:
# Decide whether or not Mako template modules will be cached.
module_directory = os.path.join(app_conf['cache_dir'], 'templates')
if config.get('cache_mako_templates') == 'False':
module_directory = None
# Create the Mako TemplateLookup, with the default auto-escaping
config['pylons.app_globals'].mako_lookup = TemplateLookup(
directories=paths['templates'],
error_handler=handle_mako_error,
module_directory=module_directory,
input_encoding='utf-8', default_filters=['escape'],
imports=['from webhelpers.html import escape'])
Then the INI file can optionally dictate that caching should not be done
by Mako. This suits my needs because I only want to disable caching
while in development; once in production I want to take advantage of
caching. It seems to work fine but I'd still like to hear if there's a
better solution out there.
Lance
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.