summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-05-05 22:33:08 +0200
committerClaude Paroz <claude@2xlibre.net>2012-05-05 22:33:08 +0200
commit57102ce7819ecc3df3e979a4926d0cecc09c6f6e (patch)
tree84cc4a93c9c7e72a30a3592e400d9e68c1069ad1
parentd7dfab59ead97b35c6f6786784225f377783e376 (diff)
Used io.BytesIO also for ContentFile.
io.StringIO would force the content to be Unicode, which would be slightly backwards incompatible.
-rw-r--r--django/core/files/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/files/base.py b/django/core/files/base.py
index d9b0fabb33..4d19acd5ba 100644
--- a/django/core/files/base.py
+++ b/django/core/files/base.py
@@ -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):