diff options
| author | Preston Timmons <prestontimmons@gmail.com> | 2015-03-02 13:31:14 -0600 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@oscaro.com> | 2015-03-03 21:20:46 +0100 |
| commit | 70123cf084e3af7dfc61bb7bd2090ff802c3cda4 (patch) | |
| tree | 9107fd8cb2c55009df2f58371cd66e32d792b677 /django/template | |
| parent | 85757d0e79f4237d7cf3ee1785946315aa6959eb (diff) | |
Fixed #24399 -- Made filesystem loaders use more specific exceptions.
Diffstat (limited to 'django/template')
| -rw-r--r-- | django/template/loaders/filesystem.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/template/loaders/filesystem.py b/django/template/loaders/filesystem.py index cb61d576ed..74801efe56 100644 --- a/django/template/loaders/filesystem.py +++ b/django/template/loaders/filesystem.py @@ -2,6 +2,7 @@ Wrapper for loading templates from the filesystem. """ +import errno import io from django.core.exceptions import SuspiciousFileOperation @@ -37,6 +38,7 @@ class Loader(BaseLoader): try: with io.open(filepath, encoding=self.engine.file_charset) as fp: return fp.read(), filepath - except IOError: - pass + except IOError as e: + if e.errno != errno.ENOENT: + raise raise TemplateDoesNotExist(template_name) |
