#24128: Admindocs doesn't account for template loaders
-----------------------------------+------------------------------------
Reporter: Aymeric Augustin | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Kris Avi):
* cc: Kris Avi (added)
Comment:
It seems it is quite fixable with something like that:
That is probably not the most elegant solution. Tried to get loaders from
all the engines and combine their location directories into one to send to
enumerator.
{{{
...
pass
else:
# This doesn't account for template loaders (#24128).
# Fix for #24128
from django.template import engines
directories = set(default_engine.dirs) #
making set with default engine dirs parameter as initial set
for engine in engines.all(): #
going through all the engines
for loader in engine.engine.template_loaders: #
getting each template loader from engine
directories.update(loader.get_dirs()) #
updating set with new directories from loaders
for index, directory in enumerate(directories): #
new enumerator with all dirs from default and loaders
# for index, directory in enumerate(default_engine.dirs): #
commented out original enumerator
# End of fix for #24128
template_file = os.path.join(directory, template)
templates.append({
...
}}}
instead of
{{{
...
pass
else:
# This doesn't account for template loaders (#24128).
for index, directory in enumerate(default_engine.dirs):
template_file = os.path.join(directory, template)
templates.append({
...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24128#comment:2>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.481bdf00b3c9592868265e7d09b40f11%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.