Commits

adamnelson  committed 0ee1249

If key does not exist, create one

  • Participants
  • Parent commits d4014b8

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

         cleaned_name = self._clean_name(name)
         name = self._normalize_name(cleaned_name)
         headers = self.headers
-        content_type = mimetypes.guess_type(name)[0] or Key.DefaultContentType            
+        content_type = mimetypes.guess_type(name)[0] or Key.DefaultContentType
 
         if self.gzip and content_type in self.gzip_content_types:
             content = self._compress_content(content)
         self._storage = storage
         self.name = name[len(self._storage.location):].lstrip('/')
         self._mode = mode
-        self.key = storage.bucket.get_key(name)
+        self.key = storage.bucket.get_key(name) or storage.bucket.new_key(name)
         self._is_dirty = False
         self._file = None