From bf2f5dcb2066970a0fa3c7eadcf134b3637a097d Mon Sep 17 00:00:00 2001 From: jcoux Date: Fri, 22 Dec 2017 07:47:54 +0100 Subject: [PATCH] [10.0] Fix connection errors when we read attachment --- attachment_swift/models/ir_attachment.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/attachment_swift/models/ir_attachment.py b/attachment_swift/models/ir_attachment.py index b336cb3..e923095 100644 --- a/attachment_swift/models/ir_attachment.py +++ b/attachment_swift/models/ir_attachment.py @@ -57,7 +57,13 @@ class IrAttachment(models.Model): def _store_file_read(self, fname, bin_size=False): if fname.startswith('swift://'): swifturi = SwiftUri(fname) - conn = self._get_swift_connection() + try: + conn = self._get_swift_connection() + except exceptions.UserError: + _logger.exception( + "error reading attachment '%s' from object storage", fname + ) + return '' try: resp, obj_content = conn.get_object(swifturi.container(), swifturi.item())