--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C69976DE1603\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 18:16:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.044\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.044 tagged_above=-999 required=5\r
+ tests=[AWL=-0.044] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Fi7jsl57tU3y for <notmuch@notmuchmail.org>;\r
+ Wed, 9 Dec 2015 18:16:43 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id BA1056DE005F\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 18:16:42 -0800 (PST)\r
+Received: from fifthhorseman.net (unknown [38.109.115.130])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 7002CF984\r
+ for <notmuch@notmuchmail.org>; Wed, 9 Dec 2015 21:16:40 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 53061207F2; Wed, 9 Dec 2015 21:16:40 -0500 (EST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2] add notmuch.Database.get_status_string()\r
+Date: Wed, 9 Dec 2015 21:16:40 -0500\r
+Message-Id: <1449713800-25608-1-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.6.2\r
+In-Reply-To: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 10 Dec 2015 02:16:45 -0000\r
+\r
+This gives some additional access to debugging information when using\r
+the python bindings.\r
+---\r
+ bindings/python/notmuch/database.py | 16 ++++++++++++++++\r
+ 1 file changed, 16 insertions(+)\r
+\r
+diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
+index 5b58e09..d29c292 100644\r
+--- a/bindings/python/notmuch/database.py\r
++++ b/bindings/python/notmuch/database.py\r
+@@ -114,6 +114,11 @@ class Database(object):\r
+ _get_all_tags.argtypes = [NotmuchDatabaseP]\r
+ _get_all_tags.restype = NotmuchTagsP\r
+ \r
++ """notmuch_database_status_string"""\r
++ _get_status_string = nmlib.notmuch_database_status_string\r
++ _get_status_string.argtypes = [NotmuchDatabaseP]\r
++ _get_status_string.restype = c_char_p\r
++\r
+ """notmuch_database_create"""\r
+ _create = nmlib.notmuch_database_create\r
+ _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]\r
+@@ -575,6 +580,17 @@ class Database(object):\r
+ """\r
+ return Query(self, querystring)\r
+ \r
++ def get_status_string(self):\r
++ """Returns the status string of the database\r
++\r
++ This is sometimes used for additional error reporting\r
++ """\r
++ self._assert_db_is_initialized()\r
++ s = Database._get_status_string(self._db)\r
++ if s:\r
++ return s.decode('utf-8', 'ignore')\r
++ return s\r
++\r
+ def __repr__(self):\r
+ return "'Notmuch DB " + self.get_path() + "'"\r
+ \r
+-- \r
+2.6.2\r
+\r