1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Used io.BytesIO also for ContentFile.

io.StringIO would force the content to be Unicode, which would be
slightly backwards incompatible.
This commit is contained in:
Claude Paroz 2012-05-05 22:33:08 +02:00
parent d7dfab59ea
commit 57102ce781

View File

@ -1,5 +1,5 @@
import os
from io import BytesIO, StringIO
from io import BytesIO
from django.utils.encoding import smart_str, smart_unicode
from django.core.files.utils import FileProxyMixin
@ -126,7 +126,7 @@ class ContentFile(File):
"""
def __init__(self, content, name=None):
content = content or ''
super(ContentFile, self).__init__(StringIO(content), name=name)
super(ContentFile, self).__init__(BytesIO(content), name=name)
self.size = len(content)
def __str__(self):