summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-05-25 20:37:38 +0200
committerClaude Paroz <claude@2xlibre.net>2012-05-25 20:43:43 +0200
commitedfa95c22ffe8f58060bb985ad1b6fbca9506f5e (patch)
tree9a8af000d186d2e9188c674bcb29fe5e52575f41 /django/template
parente73838b6ddcc7b37c03f9eee04fa6e6a283fedb3 (diff)
Specified when open should use binary mode.
Thanks Vinaj Sajip for the help of his django3 branch.
Diffstat (limited to 'django/template')
-rw-r--r--django/template/loaders/app_directories.py2
-rw-r--r--django/template/loaders/filesystem.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/django/template/loaders/app_directories.py b/django/template/loaders/app_directories.py
index d6b3a17c8c..6e0f079de7 100644
--- a/django/template/loaders/app_directories.py
+++ b/django/template/loaders/app_directories.py
@@ -52,7 +52,7 @@ class Loader(BaseLoader):
def load_template_source(self, template_name, template_dirs=None):
for filepath in self.get_template_sources(template_name, template_dirs):
try:
- with open(filepath) as fp:
+ with open(filepath, 'rb') as fp:
return (fp.read().decode(settings.FILE_CHARSET), filepath)
except IOError:
pass
diff --git a/django/template/loaders/filesystem.py b/django/template/loaders/filesystem.py
index 8352406424..e87cfef987 100644
--- a/django/template/loaders/filesystem.py
+++ b/django/template/loaders/filesystem.py
@@ -34,7 +34,7 @@ class Loader(BaseLoader):
tried = []
for filepath in self.get_template_sources(template_name, template_dirs):
try:
- with open(filepath) as fp:
+ with open(filepath, 'rb') as fp:
return (fp.read().decode(settings.FILE_CHARSET), filepath)
except IOError:
tried.append(filepath)