mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
fixup! fixup! attachment_s3: Add set ACL function
This commit is contained in:
@@ -16,7 +16,6 @@ _logger = logging.getLogger(__name__)
|
|||||||
try:
|
try:
|
||||||
import boto3
|
import boto3
|
||||||
from botocore.exceptions import ClientError, EndpointConnectionError
|
from botocore.exceptions import ClientError, EndpointConnectionError
|
||||||
from botocore.errorfactory import NoSuchKey
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
boto3 = None # noqa
|
boto3 = None # noqa
|
||||||
ClientError = None # noqa
|
ClientError = None # noqa
|
||||||
@@ -128,14 +127,16 @@ class IrAttachment(models.Model):
|
|||||||
"ACL %s successfully set on object %s" % (acl, fname)
|
"ACL %s successfully set on object %s" % (acl, fname)
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
except NoSuchKey:
|
except ClientError as e:
|
||||||
_logger.exception(
|
error_code = e.response['Error']['Code']
|
||||||
"Object %s does not exists on S3 bucket" % fname
|
if error_code == "NoSuchKey":
|
||||||
)
|
_logger.exception(
|
||||||
except ClientError:
|
"Object %s does not exists on S3 bucket" % fname
|
||||||
_logger.exception(
|
)
|
||||||
"Cannot set ACL %s on object %s" % (acl, fname)
|
else:
|
||||||
)
|
_logger.exception(
|
||||||
|
"Cannot set ACL %s on object %s" % (acl, fname)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
_logger.warning("Cannot set ACL on object not stored on S3")
|
_logger.warning("Cannot set ACL on object not stored on S3")
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user