1 Return-Path: <hahj87@gmail.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 C658041ED91
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 10:14:10 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id FLIahZaun-wX for <notmuch@notmuchmail.org>;
\r
18 Wed, 1 Feb 2012 10:14:10 -0800 (PST)
\r
19 Received: from mail-tul01m020-f181.google.com (mail-tul01m020-f181.google.com
\r
20 [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 3E5E6421192
\r
23 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 10:14:10 -0800 (PST)
\r
24 Received: by obbup10 with SMTP id up10so1844034obb.26
\r
25 for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 10:14:08 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:subject:user-agent:date:message-id:mime-version
\r
28 :content-type; bh=XefO5mXG+rN9Xb+46IV3pxKj0C2+NNVwENcKfLTn1I4=;
\r
29 b=b4cW42O5Fxs2u2i9hEa10vNpMaeC2uSmHzUYFmULzVFQ+ME21JYR7Q+KdBXH7eBLvF
\r
30 Ot1ov1J7BS3oTo3/zLxiRudiQtPgwLAGaeGZKnvQxQ7RHr6UOzI06cYOziw9Lqr71h00
\r
31 LL1EBbsCx5T14z5+sR8GK1ojXAPImcjO2yl38=
\r
32 Received: by 10.182.192.8 with SMTP id hc8mr31011131obc.25.1328120048575;
\r
33 Wed, 01 Feb 2012 10:14:08 -0800 (PST)
\r
34 Received: from stravy ([189.249.68.40])
\r
35 by mx.google.com with ESMTPS id p3sm10125979obm.9.2012.02.01.10.14.06
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Wed, 01 Feb 2012 10:14:07 -0800 (PST)
\r
38 From: Joshua Ismael Haase Hernandez <hahj87@gmail.com>
\r
39 To: Notmuch <notmuch@notmuchmail.org>
\r
40 Subject: [patch] notmuch-addresses.py fix UnicodeDecodeError
\r
41 User-Agent: Notmuch/0.10.2 (http://notmuchmail.org) Emacs/23.3.1
\r
42 (mips64el-unknown-linux-gnu)
\r
43 Date: Wed, 01 Feb 2012 12:09:49 -0600
\r
45 <874nva2zo2.fsf@stravy.i-did-not-set--mail-host-address--so-tickle-me>
\r
47 Content-Type: multipart/mixed; boundary="=-=-="
\r
48 X-Mailman-Approved-At: Thu, 02 Feb 2012 08:56:31 -0800
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Wed, 01 Feb 2012 18:14:10 -0000
\r
64 Content-Type: multipart/signed; boundary="==-=-=";
\r
65 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
68 Content-Type: text/plain; charset=utf-8
\r
69 Content-Transfer-Encoding: quoted-printable
\r
73 I am using notmuch and notmuch-adresses.py for adress completion. My
\r
74 native language is spanish and so most of my contact names contain
\r
75 accents or '=C3=B1', so python script failed for them.
\r
77 I attach the fix, sorry about emacs blank spaces cleanup.
\r
81 Content-Type: application/pgp-signature
\r
83 -----BEGIN PGP SIGNATURE-----
\r
84 Version: GnuPG v1.4.11 (GNU/Linux)
\r
86 iQIcBAEBAgAGBQJPKX/xAAoJECS+N057RKv5HGQP/3FZjKZGlneBtWipc8CHshhR
\r
87 7L9Oh6Iwktx7MZwOd9Cl2s44KV1tTPyWQP3csJp9IwT+YTlDHOs51A5bIRyXpCPI
\r
88 IL6AuiU3fgJjYsLKH+Niss3i3IqiWCPk4DFtoRvM6fp1DmkczK2oTSzTrGe0Nu6Q
\r
89 qA7JEeiN4+YbeVCTzPflzybrJOD01LnwrQxkqrirZLmLSgdZWiZezn4SsBkRWDBc
\r
90 4+zvN0eeLwmNefSqk0NoPepaFb0AF25XY4eQEXwXjhpxn7JEU3BMqQKoSq8kWn15
\r
91 LVOABe1fMi1ddt5xcV8wPa5gcVaRHjPqkJFWsfQKlS0sThyZ7OuEZIDGqr7Z+sj5
\r
92 44QR588Z36M1GreesfRDiyhyOCU+Th1y1aueLBPcRk7LS1UCN3Skiy+W02a++Ne0
\r
93 MQQ4BJ5PM82+Ci2wrhNb1hgv0ysghci85HwJ4UFkNipmPc3CuSNvTUWgNkG27uhr
\r
94 hVeHouPoVBgNJUF6n/3EHud4YCUwrmxsVAZZ2e7S5vYaHx5kA+sMFeKdL1czaM37
\r
95 64DHD7s2sjnLH9F6k99wIu7c3AD3Xd8UfAhSQ791BHyn5VGZiSemmlRLBUao6svn
\r
96 tdhKWy8pMXOvWYgIQbQUHSfs4YmBxcLRXtgTGZJbiU06498YcP6Z2QVCcpSv+2dh
\r
97 RBesVOIbNKDOh2LMfHWD
\r
99 -----END PGP SIGNATURE-----
\r
103 Content-Type: text/x-patch
\r
104 Content-Disposition: attachment; filename=fix-decodeError-non-ascii.patch
\r
105 Content-Description: Fix UnicodeDecodeError
\r
107 diff --git a/notmuch_addresses.py b/notmuch_addresses.py
\r
108 index 74a743c..866b327 100755
\r
109 --- a/notmuch_addresses.py
\r
110 +++ b/notmuch_addresses.py
\r
112 ## GNU General Public License for more details.
\r
114 ## NOTE: This script requires the notmuch python bindings.
\r
118 import ConfigParser
\r
120 @@ -43,7 +43,7 @@ class EmailsWithNames(object):
\r
121 as a list email addresses (with or without best-choice real
\r
122 names), sorted by frequency.
\r
126 def __init__(self):
\r
129 @@ -92,7 +92,7 @@ class EmailsWithNames(object):
\r
132 def sorted_email_list(self):
\r
133 - return sorted(self.emails.keys(),
\r
134 + return sorted(self.emails.keys(),
\r
135 key=self.email_freq,
\r
138 @@ -105,7 +105,7 @@ class NotmuchAddressMatcher(object):
\r
139 """A simple address matcher, based on information information from
\r
140 the user's $HOME/.notmuch-config file.
\r
144 def __init__(self, query_name, match_function=None):
\r
147 @@ -167,15 +167,15 @@ class NotmuchAddressMatcher(object):
\r
148 full_name = addr[0]
\r
149 split_names = full_name.split(" ")
\r
151 - if (len([name for name in split_names
\r
152 + if (len([name for name in split_names
\r
153 if self.match_function(name)]) > 0
\r
156 self.match_function(full_name)
\r
159 self.match_function(mail)):
\r
162 emails.add_email_and_name(mail, addr[0])
\r
165 self.matches = emails.sorted_email_and_names_list()
\r
167 if __name__ == '__main__':
\r
168 @@ -187,4 +187,4 @@ if __name__ == '__main__':
\r
169 matcher = NotmuchAddressMatcher(name)
\r
170 matcher.generate_matches()
\r
172 - for elem in matcher.matches: print (elem)
\r
173 + for elem in matcher.matches: print (elem.encode('utf-8'))
\r