Commits

mwolf76 committed f947ea5

Couple of bugfixes

Comments (0)

Files changed (1)

storages/backends/mosso.py

 Custom storage for django with Mosso Cloud Files backend.
 Created by Rich Leland <rich@richleland.com>.
 """
-from _io import StringIO
+# Find the best implementation available on this platform
+try:
+    from cStringIO import StringIO
+
+except ImportError:
+    from StringIO import StringIO
+
 import os
 from django.conf import settings
 from django.core.exceptions import ImproperlyConfigured
         cloud_obj = self.container.create_object(name)
         cloud_obj.size = content.size
 
-        content.open()        
+        content.open()
         # If the content type is available, pass it in directly rather than
         # getting the cloud object to try to guess.
         if hasattr(content.file, 'content_type'):
 
     file = property(_get_file, _set_file)
 
-    def read(self, num_bytes=None):
+    def read(self, num_bytes=0):
         if self._pos == self._get_size():
             return None
         if self._pos + num_bytes > self._get_size():
         return self.local_cache.container
 
     container = property(_get_container, CloudFilesStorage._set_container)
-