Fixed #22107 -- Fixed django.core.files.File object iteration.

Due to a mixup between text and bytes, iteration over
a File instance was broken under Python 3.

Thanks to trac user pdewacht for the report and patch.
This commit is contained in:
Baptiste Mispelon 2014-02-20 19:13:25 +01:00
parent cb844497d0
commit 3841feee86
2 changed files with 9 additions and 1 deletions

View file

@ -104,7 +104,7 @@ class File(FileProxyMixin):
# If this is the end of a line, yield
# otherwise, wait for the next round
if line[-1] in ('\n', '\r'):
if line[-1:] in (b'\n', b'\r'):
yield line
else:
buffer_ = line