1. David Larlet
  2. django-storages

Commits

Jannis Leidel  committed 5fbc5f9

Use GzipFile API correctly.

  • Participants
  • Parent commits 1212abf
  • Branches default

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

View file
  • Ignore whitespace
     @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)