From 963b65e99d5b0fefda98e80d749c249e4b9f0e12 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 31 Oct 2016 17:23:20 +0100 Subject: [PATCH] Storage should be 's3' --- attachment_s3/models/ir_attachment.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attachment_s3/models/ir_attachment.py b/attachment_s3/models/ir_attachment.py index 8935d58..1a192a9 100644 --- a/attachment_s3/models/ir_attachment.py +++ b/attachment_s3/models/ir_attachment.py @@ -114,7 +114,7 @@ class IrAttachment(models.Model): @api.model def _file_read(self, fname, bin_size=False): storage = self._storage() - if storage.startswith('s3') or fname.startswith('s3://'): + if storage == 's3' or fname.startswith('s3://'): read = self._file_read_s3(fname, bin_size=bin_size) if not read and not fname.startswith('s3://'): # If the attachment has been created before the installation @@ -134,7 +134,7 @@ class IrAttachment(models.Model): @api.model def _file_write(self, value, checksum): storage = self._storage() - if storage.startswith('s3'): + if storage == 's3': bucket = self._get_s3_bucket() bin_data = value.decode('base64') key = self._compute_checksum(bin_data) @@ -193,7 +193,7 @@ class IrAttachment(models.Model): ) storage = self._storage() - if not storage.startswith('s3'): + if storage != 's3': return _logger.info('migrating files to the object storage') domain = ['!', ('store_fname', '=like', 's3://%'), @@ -269,7 +269,7 @@ class IrAttachment(models.Model): @api.model def force_storage(self): storage = self._storage() - if storage.startswith('s3'): + if storage == 's3': self._force_storage_s3() else: return super(IrAttachment, self).force_storage()