Commits

David Larlet committed a12646a

Boto & Mosso: test existence of content_type, refs #5 (boto) and #18 (mosso). Thanks @adamnelson.

  • Participants
  • Parent commits 684e976

Comments (0)

Files changed (2)

backends/mosso.py

         else:
             content_str = content.read()
         cloud_obj = self.container.create_object(name)
-        cloud_obj.content_type = content.file.content_type
+        if hasattr(content.file, 'content_type'):
+            cloud_obj.content_type = content.file.content_type
         cloud_obj.send(content_str)
         content.close()
         return name

backends/s3boto.py

     
     def _save(self, name, content):
         headers = self.headers
-        headers['Content-Type'] = content.file.content_type
+        if hasattr(content.file, 'content_type'):
+            headers['Content-Type'] = content.file.content_type
+        content.name = name
         k = self.bucket.get_key(name)
         if not k:
             k = self.bucket.new_key(name)