summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-04-18 17:51:13 +0200
committerClaude Paroz <claude@2xlibre.net>2014-04-18 17:55:35 +0200
commited532a6a1ee675432940e69cec866b52aca96575 (patch)
treefb6248d5d2f2ff41c7f5db22a6e8244e6c62872a
parentc2b269df6e9221cbca21fc90e46ccaf8c7d608a2 (diff)
Fixed #22399 -- Forced fixture reading in binary mode
This might help on systems where default encoding is not UTF-8 (and on Python 3). Thanks bacilla for the report.
-rw-r--r--django/core/management/commands/loaddata.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index 44583bd41e..beceec1e77 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -125,7 +125,8 @@ class Command(BaseCommand):
for fixture_file, fixture_dir, fixture_name in self.find_fixtures(fixture_label):
_, ser_fmt, cmp_fmt = self.parse_name(os.path.basename(fixture_file))
open_method = self.compression_formats[cmp_fmt]
- fixture = open_method(fixture_file, 'r')
+ # Forcing binary mode may be revisited after dropping Python 2 support (see #22399)
+ fixture = open_method(fixture_file, 'rb')
try:
self.fixture_count += 1
objects_in_fixture = 0