1
0
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:
Claude Paroz
2012-05-25 20:37:38 +02:00
parent e73838b6dd
commit edfa95c22f
6 changed files with 22 additions and 20 deletions

View File

@@ -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

View File

@@ -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)