Skip to content

Commit

Permalink
[#2578] Allow genshi snippets to access template context
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Aug 30, 2012
1 parent ea8925d commit 1f213ce
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ckan/lib/base.py
Expand Up @@ -99,17 +99,18 @@ def render_template():
# we remove it so any bad templates crash and burn
del globs['url']

# snippets should not pass the context
if renderer == 'snippet':
del globs['c']
del globs['tmpl_context']

try:
template_path, template_type = lib.render.template_info(template_name)
except lib.render.TemplateNotFound:
template_type = 'genshi'
template_path = ''

# snippets should not pass the context
# but allow for legacy genshi templates
if renderer == 'snippet' and template_type != 'genshi':
del globs['c']
del globs['tmpl_context']

log.debug('rendering %s [%s]' % (template_path, template_type))
if config.get('debug'):
context_vars = globs.get('c')
Expand Down

0 comments on commit 1f213ce

Please sign in to comment.