Re: How does notmuch track mails?
[notmuch-archives.git] / 32 / 57b4956255f74e1225a41296bf6bc469fd1bd8
1 Return-Path: <dkg@fifthhorseman.net>\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 arlo.cworth.org (Postfix) with ESMTP id 5B2DB6DE0FF1\r
6  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 18:12:59 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.05\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.05 tagged_above=-999 required=5 tests=[AWL=-0.050]\r
12  autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id rBARnm2DMfYw for <notmuch@notmuchmail.org>;\r
16  Wed,  9 Dec 2015 18:12:56 -0800 (PST)\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
18  by arlo.cworth.org (Postfix) with ESMTP id B55556DE005F\r
19  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 18:12:55 -0800 (PST)\r
20 Received: from fifthhorseman.net (unknown [38.109.115.130])\r
21  by che.mayfirst.org (Postfix) with ESMTPSA id 2F549F984\r
22  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 21:12:52 -0500 (EST)\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
24  id 121AA20548; Wed,  9 Dec 2015 21:12:53 -0500 (EST)\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH] add notmuch.Database.get_status_string()\r
28 Date: Wed,  9 Dec 2015 21:12:53 -0500\r
29 Message-Id: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net>\r
30 X-Mailer: git-send-email 2.6.2\r
31 X-BeenThere: notmuch@notmuchmail.org\r
32 X-Mailman-Version: 2.1.20\r
33 Precedence: list\r
34 List-Id: "Use and development of the notmuch mail system."\r
35  <notmuch.notmuchmail.org>\r
36 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
37  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
39 List-Post: <mailto:notmuch@notmuchmail.org>\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
41 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
42  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
43 X-List-Received-Date: Thu, 10 Dec 2015 02:12:59 -0000\r
44 \r
45 This gives some additional access to debugging information when using\r
46 the python bindings.\r
47 ---\r
48  bindings/python/notmuch/database.py | 13 +++++++++++++\r
49  1 file changed, 13 insertions(+)\r
50 \r
51 diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
52 index 5b58e09..5f80267 100644\r
53 --- a/bindings/python/notmuch/database.py\r
54 +++ b/bindings/python/notmuch/database.py\r
55 @@ -114,6 +114,11 @@ class Database(object):\r
56      _get_all_tags.argtypes = [NotmuchDatabaseP]\r
57      _get_all_tags.restype = NotmuchTagsP\r
58  \r
59 +    """notmuch_database_status_string"""\r
60 +    _get_status_string = nmlib.notmuch_database_status_string\r
61 +    _get_status_string.argtypes = [NotmuchDatabaseP]\r
62 +    _get_status_string.restype = c_char_p\r
63 +\r
64      """notmuch_database_create"""\r
65      _create = nmlib.notmuch_database_create\r
66      _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]\r
67 @@ -575,6 +580,14 @@ class Database(object):\r
68          """\r
69          return Query(self, querystring)\r
70  \r
71 +    def get_status_string(self):\r
72 +        """Returns the status string of the database\r
73 +\r
74 +        This is sometimes used for additional error reporting\r
75 +        """\r
76 +        self._assert_db_is_initialized()\r
77 +        return Database._get_status_string(self._db).decode('utf-8', 'ignore')\r
78 +\r
79      def __repr__(self):\r
80          return "'Notmuch DB " + self.get_path() + "'"\r
81  \r
82 -- \r
83 2.6.2\r
84 \r