#13573: Cached template loader can return incorrect template
-----------------------------+----------------------------------------------
Reporter: lamby | Owner: nobody
Status: new | Milestone:
Component: Template system | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 1 |
-----------------------------+----------------------------------------------
The cached.Loader's `find_template` method constructs a cache key based
solely on the requested template name and does not include the
`template_dirs`. This results in `find_template` returning the incorrect
template where a template with the same `template_name` was previously
loaded and cached from a different set of `template_dirs`. That is to say,
the function is overly non-injective.
For example, the following snippets return the __same__ `Template`. when
they should return a different template for `templates/foo/file.html` and
`templates/bar/file.html` respectfully:
{{{
#!python
from django.template import loader
a = loader.find_template('file.html', ('templates/foo',))
b = loader.find_template('file.html', ('templates/bar',))
}}}
Patch attached.
--
Ticket URL: <http://code.djangoproject.com/ticket/13573>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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/django-updates?hl=en.