Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Used io.BytesIO also for ContentFile.

io.StringIO would force the content to be Unicode, which would be
slightly backwards incompatible.
  • Loading branch information...
commit 57102ce7819ecc3df3e979a4926d0cecc09c6f6e 1 parent d7dfab5
Claude Paroz authored May 05, 2012

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/core/files/base.py
4  django/core/files/base.py
... ...
@@ -1,5 +1,5 @@
1 1
 import os
2  
-from io import BytesIO, StringIO
  2
+from io import BytesIO
3 3
 
4 4
 from django.utils.encoding import smart_str, smart_unicode
5 5
 from django.core.files.utils import FileProxyMixin
@@ -126,7 +126,7 @@ class ContentFile(File):
126 126
     """
127 127
     def __init__(self, content, name=None):
128 128
         content = content or ''
129  
-        super(ContentFile, self).__init__(StringIO(content), name=name)
  129
+        super(ContentFile, self).__init__(BytesIO(content), name=name)
130 130
         self.size = len(content)
131 131
 
132 132
     def __str__(self):

0 notes on commit 57102ce

Please sign in to comment.
Something went wrong with that request. Please try again.