mirror of
https://github.com/django/django.git
synced 2025-10-30 09:06:13 +00:00
Specified when open should use binary mode.
Thanks Vinaj Sajip for the help of his django3 branch.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user