From: Daniel Kahn Gillmor Date: Thu, 10 Dec 2015 02:12:53 +0000 (+1900) Subject: [PATCH] add notmuch.Database.get_status_string() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b6e1c7300d72b99e97dd880182b93aa9edee6cfb;p=notmuch-archives.git [PATCH] add notmuch.Database.get_status_string() --- diff --git a/32/57b4956255f74e1225a41296bf6bc469fd1bd8 b/32/57b4956255f74e1225a41296bf6bc469fd1bd8 new file mode 100644 index 000000000..e92c44466 --- /dev/null +++ b/32/57b4956255f74e1225a41296bf6bc469fd1bd8 @@ -0,0 +1,84 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 5B2DB6DE0FF1 + for ; Wed, 9 Dec 2015 18:12:59 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.05 +X-Spam-Level: +X-Spam-Status: No, score=-0.05 tagged_above=-999 required=5 tests=[AWL=-0.050] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id rBARnm2DMfYw for ; + Wed, 9 Dec 2015 18:12:56 -0800 (PST) +Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) + by arlo.cworth.org (Postfix) with ESMTP id B55556DE005F + for ; Wed, 9 Dec 2015 18:12:55 -0800 (PST) +Received: from fifthhorseman.net (unknown [38.109.115.130]) + by che.mayfirst.org (Postfix) with ESMTPSA id 2F549F984 + for ; Wed, 9 Dec 2015 21:12:52 -0500 (EST) +Received: by fifthhorseman.net (Postfix, from userid 1000) + id 121AA20548; Wed, 9 Dec 2015 21:12:53 -0500 (EST) +From: Daniel Kahn Gillmor +To: Notmuch Mail +Subject: [PATCH] add notmuch.Database.get_status_string() +Date: Wed, 9 Dec 2015 21:12:53 -0500 +Message-Id: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net> +X-Mailer: git-send-email 2.6.2 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 10 Dec 2015 02:12:59 -0000 + +This gives some additional access to debugging information when using +the python bindings. +--- + bindings/python/notmuch/database.py | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py +index 5b58e09..5f80267 100644 +--- a/bindings/python/notmuch/database.py ++++ b/bindings/python/notmuch/database.py +@@ -114,6 +114,11 @@ class Database(object): + _get_all_tags.argtypes = [NotmuchDatabaseP] + _get_all_tags.restype = NotmuchTagsP + ++ """notmuch_database_status_string""" ++ _get_status_string = nmlib.notmuch_database_status_string ++ _get_status_string.argtypes = [NotmuchDatabaseP] ++ _get_status_string.restype = c_char_p ++ + """notmuch_database_create""" + _create = nmlib.notmuch_database_create + _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)] +@@ -575,6 +580,14 @@ class Database(object): + """ + return Query(self, querystring) + ++ def get_status_string(self): ++ """Returns the status string of the database ++ ++ This is sometimes used for additional error reporting ++ """ ++ self._assert_db_is_initialized() ++ return Database._get_status_string(self._db).decode('utf-8', 'ignore') ++ + def __repr__(self): + return "'Notmuch DB " + self.get_path() + "'" + +-- +2.6.2 +