1 Return-Path: <teythoon@jade-hamburg.de>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 9A346431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 18:06:46 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id GBH3hDJ0LHdo for <notmuch@notmuchmail.org>;
\r
16 Sun, 25 Sep 2011 18:06:46 -0700 (PDT)
\r
17 Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])
\r
18 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 2A645431FB6
\r
21 for <notmuch@notmuchmail.org>; Sun, 25 Sep 2011 18:06:46 -0700 (PDT)
\r
22 Received: from mail.jade-hamburg.de (unknown [85.183.11.228])
\r
23 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
24 (No client certificate requested)
\r
25 by mail.cryptobitch.de (Postfix) with ESMTPSA id 0903B505B23
\r
26 for <notmuch@notmuchmail.org>; Mon, 26 Sep 2011 03:06:45 +0200 (CEST)
\r
27 Received: by mail.jade-hamburg.de (Postfix, from userid 401)
\r
28 id 7EB79DF2A0; Mon, 26 Sep 2011 03:06:44 +0200 (CEST)
\r
29 Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.109])
\r
30 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
31 (No client certificate requested) (Authenticated sender: teythoon)
\r
32 by mail.jade-hamburg.de (Postfix) with ESMTPSA id 87857DF2A4;
\r
33 Mon, 26 Sep 2011 03:06:14 +0200 (CEST)
\r
34 Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.76)
\r
35 (envelope-from <teythoon@thinkbox.jade-hamburg.de>)
\r
36 id 1R7ze5-0007Ob-VS; Mon, 26 Sep 2011 03:06:10 +0200
\r
37 From: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 9/9] python: raise a more specific error in
\r
40 Messages.print_messages
\r
41 Date: Mon, 26 Sep 2011 03:05:37 +0200
\r
43 <1316999137-28257-9-git-send-email-4winter@informatik.uni-hamburg.de>
\r
44 X-Mailer: git-send-email 1.7.6.3
\r
46 <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de>
\r
48 <1316999137-28257-1-git-send-email-4winter@informatik.uni-hamburg.de>
\r
49 X-Mailman-Approved-At: Mon, 26 Sep 2011 09:17:56 -0700
\r
50 Cc: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
51 X-BeenThere: notmuch@notmuchmail.org
\r
52 X-Mailman-Version: 2.1.13
\r
54 List-Id: "Use and development of the notmuch mail system."
\r
55 <notmuch.notmuchmail.org>
\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
59 List-Post: <mailto:notmuch@notmuchmail.org>
\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
63 X-List-Received-Date: Mon, 26 Sep 2011 01:06:46 -0000
\r
65 Raising Exception is considered bad since the only way to catch
\r
66 it is to do 'except Exception'. Raising a TypeError is more
\r
69 Since the format parameter has already been validated, checking
\r
70 it again is not necessary. Simplify this conditional.
\r
72 Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
74 bindings/python/notmuch/message.py | 6 ++----
\r
75 1 files changed, 2 insertions(+), 4 deletions(-)
\r
77 diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py
\r
78 index ac708ec..a40932a 100644
\r
79 --- a/bindings/python/notmuch/message.py
\r
80 +++ b/bindings/python/notmuch/message.py
\r
81 @@ -188,7 +188,7 @@ class Messages(object):
\r
86 + raise TypeError("format must be either 'text' or 'json'")
\r
90 @@ -209,10 +209,8 @@ class Messages(object):
\r
91 if (match or entire_thread):
\r
92 if format.lower() == "text":
\r
93 sys.stdout.write(msg.format_message_as_text(indent))
\r
94 - elif format.lower() == "json":
\r
95 - sys.stdout.write(msg.format_message_as_json(indent))
\r
97 - raise NotmuchError
\r
98 + sys.stdout.write(msg.format_message_as_json(indent))
\r
99 next_indent = indent + 1
\r
101 # get replies and print them also out (if there are any)
\r