Commits

Jannis Leidel committed 5fbc5f9

Use GzipFile API correctly.

Comments (0)

Files changed (1)

storages/backends/s3boto.py

     @property
     def file(self):
         if self._file is None:
+            self._file = StringIO()
             content_type = mimetypes.guess_type(self.name)[0] or Key.DefaultContentType
             if (self._storage.gzip and
                     content_type in self._storage.gzip_content_types):
-                self._file = GzipFile()
-            else:
-                self._file = StringIO()
+                self._file = GzipFile(fileobj=self._file)
             if 'r' in self._mode:
                 self._is_dirty = False
                 self.key.get_contents_to_file(self._file)