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.
This commit is contained in:
parent
c2b269df6e
commit
ed532a6a1e
|
@ -125,7 +125,8 @@ class Command(BaseCommand):
|
||||||
for fixture_file, fixture_dir, fixture_name in self.find_fixtures(fixture_label):
|
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))
|
_, ser_fmt, cmp_fmt = self.parse_name(os.path.basename(fixture_file))
|
||||||
open_method = self.compression_formats[cmp_fmt]
|
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:
|
try:
|
||||||
self.fixture_count += 1
|
self.fixture_count += 1
|
||||||
objects_in_fixture = 0
|
objects_in_fixture = 0
|
||||||
|
|
Loading…
Reference in New Issue