From nobody Thu Apr 25 10:06:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543429163376963.1640888000978; Wed, 28 Nov 2018 10:19:23 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E99A5804EB; Wed, 28 Nov 2018 18:19:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D983C7C28E; Wed, 28 Nov 2018 18:19:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CB1D43F600; Wed, 28 Nov 2018 18:19:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wASIJK5X002773 for ; Wed, 28 Nov 2018 13:19:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8394260F87; Wed, 28 Nov 2018 18:19:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-58.gru2.redhat.com [10.97.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FAA360C5C; Wed, 28 Nov 2018 18:19:15 +0000 (UTC) From: Caio Carrara To: patchew-devel@redhat.com, ccarrara@redhat.com Date: Wed, 28 Nov 2018 16:19:14 -0200 Message-Id: <20181128181914.30901-1-ccarrara@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] Defines exception handled at get_mbox_with_tags X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 28 Nov 2018 18:19:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When using try..except statement the exception must always be specified instead of using a bare except. It's a recommendation from PEP8 quoted below: A bare except: clause will catch SystemExit and KeyboardInterrupt exceptions, making it harder to interrupt a program with Control-C, and can disguise other problems. If you want to catch all exceptions that signal program errors, use except Exception: (bare except is equivalent to except BaseException:)[1] [1] - https://www.python.org/dev/peps/pep-0008/ Signed-off-by: Caio Carrara --- www/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views.py b/www/views.py index 2aae127..89a8127 100644 --- a/www/views.py +++ b/www/views.py @@ -297,7 +297,7 @@ def view_mbox(request, project, message_id): # patches, quoted-printable is safe and mostly human-readable. try: container.replace_header('Content-Transfer-Encoding', 'quoted-= printable') - except: + except KeyError: msg.add_header('Content-Transfer-Encoding', 'quoted-printable') payload =3D '\n'.join(mbox_with_tags_iter(payload, m.tags)) payload =3D quopri.encodestring(payload.encode('utf-8')) --=20 2.19.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel