#24399: Filesystem loaders should use more specific exceptions
--------------------------------------+--------------------
Reporter: prestontimmons | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The `filesystem` and `app_directories` loaders use the following pattern
in `load_template_source`:
{{{
try:
...
except IOError:
pass
}}}
If no templates can be read, `TemplateDoesNotExist` is raised.
This isn't optimal because an `IOError` can be raised for many reasons
besides a file not existing, such as permission issues.
I think the file loaders should be updated to only catch the error if the
errno is `ENOENT`.
Jinja2 does a similar check, but it includes `EISDIR`. Theoretically, a
path could resolve to both a directory and a file. It seems like a weird
use case to catch, though.
--
Ticket URL: <https://code.djangoproject.com/ticket/24399>
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/057.288f267f23a167fcb6ef602e03d52de5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.