summaryrefslogtreecommitdiff
path: root/django/core/files/uploadhandler.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-05-05 19:47:03 +0200
committerClaude Paroz <claude@2xlibre.net>2012-05-05 21:41:44 +0200
commitd7dfab59ead97b35c6f6786784225f377783e376 (patch)
treed357f2b94ef010d60e9ad6602bda5537f1a28b8d /django/core/files/uploadhandler.py
parent1583d402240d88ad2a4acc024d348a21657ccaba (diff)
downloaddjango-d7dfab59ead97b35c6f6786784225f377783e376.tar.gz
Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3.
Diffstat (limited to 'django/core/files/uploadhandler.py')
-rw-r--r--django/core/files/uploadhandler.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py
index 4316fddf43..88f78904bb 100644
--- a/django/core/files/uploadhandler.py
+++ b/django/core/files/uploadhandler.py
@@ -2,10 +2,7 @@
Base file upload handler classes, and the built-in concrete subclasses
"""
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
+from io import BytesIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
@@ -161,12 +158,12 @@ class MemoryFileUploadHandler(FileUploadHandler):
def new_file(self, *args, **kwargs):
super(MemoryFileUploadHandler, self).new_file(*args, **kwargs)
if self.activated:
- self.file = StringIO()
+ self.file = BytesIO()
raise StopFutureHandlers()
def receive_data_chunk(self, raw_data, start):
"""
- Add the data to the StringIO file.
+ Add the data to the BytesIO file.
"""
if self.activated:
self.file.write(raw_data)