Replaced six.BytesIO with io.BytesIO

This commit is contained in:
Tim Graham 2015-07-20 08:02:22 -04:00
parent ecf4ed246a
commit 6e3fe089dd
3 changed files with 6 additions and 3 deletions

View File

@ -14,6 +14,7 @@ from email.mime.message import MIMEMessage
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from email.utils import formataddr, formatdate, getaddresses, parseaddr from email.utils import formataddr, formatdate, getaddresses, parseaddr
from io import BytesIO
from django.conf import settings from django.conf import settings
from django.core.mail.utils import DNS_NAME from django.core.mail.utils import DNS_NAME
@ -145,7 +146,7 @@ class MIMEMixin():
This overrides the default as_bytes() implementation to not mangle This overrides the default as_bytes() implementation to not mangle
lines that begin with 'From '. See bug #13433 for details. lines that begin with 'From '. See bug #13433 for details.
""" """
fp = six.BytesIO() fp = BytesIO()
g = generator.BytesGenerator(fp, mangle_from_=False) g = generator.BytesGenerator(fp, mangle_from_=False)
g.flatten(self, unixfrom=unixfrom, linesep=linesep) g.flatten(self, unixfrom=unixfrom, linesep=linesep)
return fp.getvalue() return fp.getvalue()

View File

@ -9,6 +9,7 @@ import os
import shutil import shutil
import tempfile as sys_tempfile import tempfile as sys_tempfile
import unittest import unittest
from io import BytesIO
from django.core.files import temp as tempfile from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
@ -16,7 +17,7 @@ from django.http.multipartparser import MultiPartParser, parse_header
from django.test import SimpleTestCase, TestCase, client, override_settings from django.test import SimpleTestCase, TestCase, client, override_settings
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.http import urlquote from django.utils.http import urlquote
from django.utils.six import PY2, BytesIO, StringIO from django.utils.six import PY2, StringIO
from . import uploadhandler from . import uploadhandler
from .models import FileModel from .models import FileModel

View File

@ -1,9 +1,10 @@
from io import BytesIO
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.servers.basehttp import WSGIRequestHandler from django.core.servers.basehttp import WSGIRequestHandler
from django.test import SimpleTestCase from django.test import SimpleTestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
from django.test.utils import captured_stderr from django.test.utils import captured_stderr
from django.utils.six import BytesIO
class Stub(object): class Stub(object):