#1292 closed defect (fixed)
[patch] Template loader caching can cause circular imports
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The template.loader
module caches the enabled template loaders in a module global at the time of import. The resulting dynamic imports can lead to problems with circular imports. For example, a circular import will occur if the app_directories
template loader is used together with an application that tries to do anything in its __init__.py
that triggers another import of template.loader
.
The attached patch resolves this problem by caching only on the first call to find_template_source
.
Attachments (1)
Change History (4)
by , 19 years ago
Attachment: | loader_caching_fix_r2158.diff added |
---|
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
Easy pickings: | unset |
---|---|
UI/UX: | unset |
I am using Django release 1.5 and I have this error... Why?
comment:3 by , 11 years ago
I looked in the .py file and the for loop is still global. Honestly this is annoying.
Fix for template loader