You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{% ckan_extends %} should extend templates from the next path in the template paths list
Please describe the actual behaviour
{% ckan_extends %} emits a node with a numeric index into the template path list, which is cached with the rest of the compiled template. If the plugins enabled or template paths change after caching the template {% ckan_extends %} will extend from the wrong position in the template paths list. This behavior could lead to an infinite loop, a skipped intermediate template or a TemplateNotFound error (even for templates present in ckan itself)
What steps can be taken to reproduce the issue?
create a template using {% ckan_extends %}, enable the jinja2_cache_dir setting
visit a page that causes the template to be cached
modify the plugins list to add/remove plugins with template directories or add/remove modify the template_extra_paths setting
visit the page again for unexpected behavior
This is where the numeric index is added to the extends node, which is cached:
CKAN Version if known (or site URL)
all versions
Please describe the expected behaviour
{% ckan_extends %}
should extend templates from the next path in the template paths listPlease describe the actual behaviour
{% ckan_extends %}
emits a node with a numeric index into the template path list, which is cached with the rest of the compiled template. If the plugins enabled or template paths change after caching the template{% ckan_extends %}
will extend from the wrong position in the template paths list. This behavior could lead to an infinite loop, a skipped intermediate template or aTemplateNotFound
error (even for templates present in ckan itself)What steps can be taken to reproduce the issue?
{% ckan_extends %}
, enable thejinja2_cache_dir
settingtemplate_extra_paths
settingThis is where the numeric index is added to the extends node, which is cached:
ckan/ckan/lib/jinja_extensions.py
Line 132 in 621b008
This is where the cached numeric index is used on the current template path list:
ckan/ckan/lib/jinja_extensions.py
Lines 189 to 192 in 621b008
I suggest we switch this to emit the current template directory instead of a number so that we won't get this unexpected behavior.
The text was updated successfully, but these errors were encountered: