[PATCH 1/5] Fix comments about what is stored in the database
[notmuch-archives.git] / fd / fc90c1e7386f7547203601562ae4b14c34f337
1 Return-Path: <patricktotzke@googlemail.com>\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 14929431FB6\r
6         for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 14:30:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id Cldz1A7fWmhL for <notmuch@notmuchmail.org>;\r
17         Tue, 12 Jul 2011 14:30:06 -0700 (PDT)\r
18 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
19         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E4E7C431FD0\r
22         for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 14:30:05 -0700 (PDT)\r
23 Received: by wyh22 with SMTP id 22so3984681wyh.26\r
24         for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 14:30:04 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=googlemail.com; s=gamma;\r
27         h=date:from:to:cc:subject:message-id:references:mime-version\r
28         :content-type:content-disposition:in-reply-to:user-agent;\r
29         bh=4hWKUqbLo+D8M0Nn1j/r89R3Qp5VcepvAsxOXpr1wyY=;\r
30         b=Akwr2QMTTqxAa4DfDVs2jgHB4k9b7MLn+r7z3GqY86wdAs8MjWrtYU9YKiAMvMwlza\r
31         Nd7v4HyBJxONHuo3NhIXBOwmNR0/i/1sw0TLTlzN5sVMwyC9X5cItGuXsjRa7Ij+i7aE\r
32         4J+r/j4C/EM2uVfzFfz8Ko9Au3WAb0FY45WF8=\r
33 Received: by 10.227.2.199 with SMTP id 7mr325973wbk.88.1310506204501;\r
34         Tue, 12 Jul 2011 14:30:04 -0700 (PDT)\r
35 Received: from brick.lan (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com\r
36         [80.192.18.48])\r
37         by mx.google.com with ESMTPS id o19sm6783301wbh.43.2011.07.12.14.30.01\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Tue, 12 Jul 2011 14:30:02 -0700 (PDT)\r
40 Date: Tue, 12 Jul 2011 22:29:58 +0100\r
41 From: Patrick Totzke <patricktotzke@googlemail.com>\r
42 To: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
43 Subject: Re: Encodings\r
44 Message-ID: <20110712212958.GA17348@brick.lan>\r
45 References: <87zkkkx6am.fsf@SSpaeth.de>\r
46 MIME-Version: 1.0\r
47 Content-Type: multipart/signed; micalg=pgp-sha1;\r
48         protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy"\r
49 Content-Disposition: inline\r
50 In-Reply-To: <87zkkkx6am.fsf@SSpaeth.de>\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)\r
52 Cc: Notmuch developer list <notmuch@notmuchmail.org>\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Tue, 12 Jul 2011 21:30:08 -0000\r
66 \r
67 \r
68 --gBBFr7Ir9EOA20Yy\r
69 Content-Type: text/plain; charset=us-ascii\r
70 Content-Disposition: inline\r
71 Content-Transfer-Encoding: quoted-printable\r
72 \r
73 Hiya,\r
74 \r
75 I noticed that commit 687366b920caa5de6ea0b66b70cf2a11e5399f7b\r
76 breaks things with Database.get_all_tags:\r
77 \r
78 -------------------------------------->%-----------------------------------=\r
79 --\r
80 AttributeError                            Traceback (most recent call last)\r
81 \r
82 /home/pazz/projects/alot/<ipython console> in <module>()\r
83 \r
84 /usr/local/lib/python2.7/dist-packages/notmuch/tag.pyc in next(self)\r
85      86         # No need to call nmlib.notmuch_tags_valid(self._tags);\r
86 \r
87      87         # Tags._get safely returns None, if there is no more valid =\r
88 tag.\r
89 \r
90 ---> 88         tag =3D Tags._get(self._tags).decode('utf-8')\r
91      89         if tag is None:\r
92      90             self._tags =3D None\r
93 \r
94 AttributeError: 'NoneType' object has no attribute 'decode'\r
95 ------------------------------------%<-------------------------------------=\r
96 --\r
97 \r
98 The reason is that the Tags.next() tries to decode before it tests if tag i=\r
99 s None.\r
100 Now, we _could_ apply a patch like this one here:\r
101 \r
102 ---------------------------------->%---------------------------------------=\r
103 --\r
104 diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py\r
105 index 65a9118..2ae670d 100644\r
106 --- a/bindings/python/notmuch/tag.py\r
107 +++ b/bindings/python/notmuch/tag.py\r
108 @@ -85,12 +85,12 @@ class Tags(object):\r
109              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
110          # No need to call nmlib.notmuch_tags_valid(self._tags);\r
111          # Tags._get safely returns None, if there is no more valid tag.\r
112 -        tag =3D Tags._get(self._tags).decode('utf-8')\r
113 +        tag =3D Tags._get(self._tags)\r
114          if tag is None:\r
115              self._tags =3D None\r
116              raise StopIteration\r
117          nmlib.notmuch_tags_move_to_next(self._tags)\r
118 -        return tag\r
119 +        return tag.decode('utf-8')\r
120 =20\r
121      def __nonzero__(self):\r
122          """Implement bool(Tags) check that can be repeatedly used\r
123 -------------------------------------------%<-----------------------------\r
124 \r
125 But as Carl sais, we cannot guarantee that a tag is utf8 encoded anyway.\r
126 So i'd suggest we just revore the commit in question.\r
127 best,\r
128 /p\r
129 \r
130 --gBBFr7Ir9EOA20Yy\r
131 Content-Type: application/pgp-signature; name="signature.asc"\r
132 Content-Description: Digital signature\r
133 \r
134 -----BEGIN PGP SIGNATURE-----\r
135 Version: GnuPG v1.4.11 (GNU/Linux)\r
136 \r
137 iEYEARECAAYFAk4cvNYACgkQlDQDZ9fWxargfwCfWPyH3bte8jnFcqpmxzq5IIHY\r
138 eWQAnAvPZub91ujDTsgaDI1NgFwezfec\r
139 =w/5u\r
140 -----END PGP SIGNATURE-----\r
141 \r
142 --gBBFr7Ir9EOA20Yy--\r