1 Return-Path: <ukleinek@strlen.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 20223431FD0
\r
6 for <notmuch@notmuchmail.org>; Wed, 13 Jul 2011 00:04:53 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 8jVK-xAJ-v0b for <notmuch@notmuchmail.org>;
\r
16 Wed, 13 Jul 2011 00:04:51 -0700 (PDT)
\r
17 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 1071C431FB6
\r
22 for <notmuch@notmuchmail.org>; Wed, 13 Jul 2011 00:04:51 -0700 (PDT)
\r
23 Received: id: ukleinek by Chamillionaire.breakpoint.cc with local
\r
24 (easymta 1.00 BETA 1)
\r
25 id 1QgtV1-0003j4-Ch; Wed, 13 Jul 2011 09:04:47 +0200
\r
26 Date: Wed, 13 Jul 2011 09:04:47 +0200
\r
27 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= <ukleinek@strlen.de>
\r
28 To: Patrick Totzke <patricktotzke@googlemail.com>
\r
29 Subject: Re: Encodings
\r
30 Message-ID: <20110713070447.GA14254@strlen.de>
\r
31 References: <87zkkkx6am.fsf@SSpaeth.de>
\r
32 <20110712212958.GA17348@brick.lan>
\r
34 Content-Type: text/plain; charset=us-ascii
\r
35 Content-Disposition: inline
\r
36 In-Reply-To: <20110712212958.GA17348@brick.lan>
\r
37 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
38 Cc: Notmuch developer list <notmuch@notmuchmail.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Wed, 13 Jul 2011 07:04:53 -0000
\r
55 On Tue, Jul 12, 2011 at 10:29:58PM +0100, Patrick Totzke wrote:
\r
56 > I noticed that commit 687366b920caa5de6ea0b66b70cf2a11e5399f7b
\r
57 > breaks things with Database.get_all_tags:
\r
59 > -------------------------------------->%-------------------------------------
\r
60 > AttributeError Traceback (most recent call last)
\r
62 > /home/pazz/projects/alot/<ipython console> in <module>()
\r
64 > /usr/local/lib/python2.7/dist-packages/notmuch/tag.pyc in next(self)
\r
65 > 86 # No need to call nmlib.notmuch_tags_valid(self._tags);
\r
67 > 87 # Tags._get safely returns None, if there is no more valid tag.
\r
69 > ---> 88 tag = Tags._get(self._tags).decode('utf-8')
\r
70 > 89 if tag is None:
\r
71 > 90 self._tags = None
\r
73 > AttributeError: 'NoneType' object has no attribute 'decode'
\r
74 > ------------------------------------%<---------------------------------------
\r
76 > The reason is that the Tags.next() tries to decode before it tests if tag is None.
\r
77 > Now, we _could_ apply a patch like this one here:
\r
79 > ---------------------------------->%-----------------------------------------
\r
80 > diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py
\r
81 > index 65a9118..2ae670d 100644
\r
82 > --- a/bindings/python/notmuch/tag.py
\r
83 > +++ b/bindings/python/notmuch/tag.py
\r
84 > @@ -85,12 +85,12 @@ class Tags(object):
\r
85 > raise NotmuchError(STATUS.NOT_INITIALIZED)
\r
86 > # No need to call nmlib.notmuch_tags_valid(self._tags);
\r
87 > # Tags._get safely returns None, if there is no more valid tag.
\r
88 > - tag = Tags._get(self._tags).decode('utf-8')
\r
89 > + tag = Tags._get(self._tags)
\r
92 > raise StopIteration
\r
93 > nmlib.notmuch_tags_move_to_next(self._tags)
\r
95 > + return tag.decode('utf-8')
\r
97 > def __nonzero__(self):
\r
98 > """Implement bool(Tags) check that can be repeatedly used
\r
99 > -------------------------------------------%<-----------------------------
\r
101 > But as Carl sais, we cannot guarantee that a tag is utf8 encoded anyway.
\r
102 I think it would be right to enforce that tags are utf-8 encoded.
\r
103 Otherwise the users get strange results if they change their locale.
\r