mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +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:
@@ -3,10 +3,7 @@ Classes representing uploaded files.
|
||||
"""
|
||||
|
||||
import os
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
from io import BytesIO
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import File
|
||||
@@ -110,8 +107,8 @@ class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
A simple representation of a file, which just has content, size, and a name.
|
||||
"""
|
||||
def __init__(self, name, content, content_type='text/plain'):
|
||||
content = content or ''
|
||||
super(SimpleUploadedFile, self).__init__(StringIO(content), None, name,
|
||||
content = content or b''
|
||||
super(SimpleUploadedFile, self).__init__(BytesIO(content), None, name,
|
||||
content_type, len(content), None)
|
||||
|
||||
def from_dict(cls, file_dict):
|
||||
|
||||
Reference in New Issue
Block a user