12345678910111213141516171819202122232425262728293031323334 |
- def _save(self, name, content):
- """
- Use the Azure Storage service to write ``content`` to a remote file
- (called ``name``).
- """
-
- content.open()
- content_type = None
- if hasattr(content.file, 'content_type'):
- content_type = content.file.content_type
- else:
- content_type = mimetypes.guess_type(name)[0]
- cache_control = self.get_cache_control(
- self.container,
- name,
- content_type
- )
- self._get_service().put_block_blob_from_file(
- container_name=self.container,
- blob_name=name,
- stream=content,
- x_ms_blob_content_type=content_type,
- cache_control=cache_control,
- x_ms_blob_cache_control=cache_control
- )
- content.close()
- return name
|