From d7dfab59ead97b35c6f6786784225f377783e376 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 5 May 2012 19:47:03 +0200 Subject: Replaced cStringIO.StringIO by io.BytesIO. Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3. --- django/core/files/uploadhandler.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'django/core/files/uploadhandler.py') 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) -- cgit v1.2.1