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 5FD06431FD0
\r
6 for <notmuch@notmuchmail.org>; Sat, 24 Dec 2011 01:44:54 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 3nL75edUxOpI for <notmuch@notmuchmail.org>;
\r
17 Sat, 24 Dec 2011 01:44:53 -0800 (PST)
\r
18 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com
\r
19 [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 8CE1C431FB6 for <notmuch@notmuchmail.org>; Sat, 24 Dec 2011 01:44:53 -0800
\r
23 Received: by eekd41 with SMTP id d41so11917994eek.26
\r
24 for <notmuch@notmuchmail.org>; Sat, 24 Dec 2011 01:44:50 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=googlemail.com; s=gamma;
\r
27 h=message-id:content-type:mime-version:content-transfer-encoding:to
\r
29 bh=ovP8dasaK99hPg2+CLvj6PzPokE5IMGrff2UVB+PRxg=;
\r
30 b=uOCdwE8+l5pUHXZjOicf9NhBTGMTElLOloyvBoLIbpADfH31QVYsj2ffoqlYhJhfSR
\r
31 EtSi+Fpx7LT6MyDZbGmZbG+X/QoycyHpcOIN4CWbK/WjKDgRA4NIu0TZrINTwyg9I1j6
\r
32 t8Lj1heT2Zc0Ru/x3aerwcYqANS8bOQyR/NxI=
\r
33 Received: by 10.14.100.193 with SMTP id z41mr7224111eef.113.1324719890845;
\r
34 Sat, 24 Dec 2011 01:44:50 -0800 (PST)
\r
35 Received: from localhost (g224022183.adsl.alicedsl.de. [92.224.22.183])
\r
36 by mx.google.com with ESMTPS id b49sm29320584eec.9.2011.12.24.01.44.49
\r
37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
38 Sat, 24 Dec 2011 01:44:49 -0800 (PST)
\r
39 Message-ID: <4ef59f11.c9330e0a.78cb.324c@mx.google.com>
\r
40 Content-Type: text/plain; charset="utf-8"
\r
42 Content-Transfer-Encoding: quoted-printable
\r
43 To: Notmuch Mailing List <notmuch@notmuchmail.org>
\r
44 From: Patrick Totzke <patricktotzke@googlemail.com>
\r
45 Subject: [python] Threads/Messages inconsistencies
\r
46 Date: Sat, 24 Dec 2011 09:44:47 +0000
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Sat, 24 Dec 2011 09:44:54 -0000
\r
63 I noticed some inconsistencies in the way the bindings
\r
64 treat Threads and Messages
\r
65 which in my opinion should look and behave alike.
\r
67 1. There is no Query.count_threads as an equivalent to
\r
68 Query.count_messages, although there seems to be a function
\r
69 `notmuch_query_count_threads` offered by the library
\r
71 2. The docstring of Query.count_messages falsely states it's
\r
72 return value is a Messages object, when it in fact returns a long.
\r
74 3. The docstring of Threads contains a line =
\r
76 "number_of_msgs =3D len(threads)"
\r
78 "number_of_threads =3D len(threads)"
\r
80 4. Threads.__len__ smells wrong: I have 10 messages in 9 threads in my inbo=
\r
83 pazz@brick:~$ python
\r
84 Python 2.7.2+ (default, Oct 4 2011, 20:06:09) =
\r
86 [GCC 4.6.1] on linux2
\r
87 Type "help", "copyright", "credits" or "license" for more information.
\r
89 >>> d=3Dnotmuch.Database()
\r
90 >>> q=3Dd.create_query('is:inbox and not is:killed')
\r
93 >>> q.count_messages()
\r
95 >>> len(list(q.search_messages()))
\r
99 >>> len(q.search_threads())
\r
101 >>> list(q.search_threads())
\r
102 Traceback (most recent call last):
\r
103 File "<stdin>", line 1, in <module>
\r
104 File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/thread.py"=
\r
105 , line 121, in next
\r
106 raise NotmuchError(STATUS.NOT_INITIALIZED)
\r
107 notmuch.globals.NotInitializedError: Operation on uninitialized object i=
\r
112 The python session above speaks for itself I believe but this is what I =
\r
114 bad behaviour, just to make sure:
\r
115 * why does list(q.search_messages() go through and list(q.search_threads=
\r
117 * why does len(q.search_threads()) return 10 and not 9 as expected?
\r
121 I have corrected the docstrings myself and copied the code from Query.count=
\r
123 to provide a Query.count_threads. The two patches can be pulled from pazz.g=
\r
125 The count_threads patch doesn't work however, which is really surprising as=
\r
127 is straightforward. When I do a import notmuch after applying the patch, I =
\r
130 AttributeError: /usr/local/lib/libnotmuch.so.2: undefined symbol: notmuch=
\r
131 _query_count_threads
\r