mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3.
This commit is contained in:
@@ -10,10 +10,7 @@ import os
|
||||
import re
|
||||
import urlparse
|
||||
from decimal import Decimal, DecimalException
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
from io import BytesIO
|
||||
|
||||
from django.core import validators
|
||||
from django.core.exceptions import ValidationError
|
||||
@@ -554,9 +551,9 @@ class ImageField(FileField):
|
||||
file = data.temporary_file_path()
|
||||
else:
|
||||
if hasattr(data, 'read'):
|
||||
file = StringIO(data.read())
|
||||
file = BytesIO(data.read())
|
||||
else:
|
||||
file = StringIO(data['content'])
|
||||
file = BytesIO(data['content'])
|
||||
|
||||
try:
|
||||
# load() is the only method that can spot a truncated JPEG,
|
||||
|
||||
Reference in New Issue
Block a user