From: Daniel Kahn Gillmor Date: Thu, 10 Dec 2015 02:16:40 +0000 (+1900) Subject: [PATCH v2] add notmuch.Database.get_status_string() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=74727ecb9713f5d0f2db3a7f578c84f94af5bbeb;p=notmuch-archives.git [PATCH v2] add notmuch.Database.get_status_string() --- diff --git a/03/12c6d19cdfb3a7f6b9cacdb1c7acb5560ad8d8 b/03/12c6d19cdfb3a7f6b9cacdb1c7acb5560ad8d8 new file mode 100644 index 000000000..1e0afb200 --- /dev/null +++ b/03/12c6d19cdfb3a7f6b9cacdb1c7acb5560ad8d8 @@ -0,0 +1,89 @@ +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 C69976DE1603 + for ; Wed, 9 Dec 2015 18:16:44 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.044 +X-Spam-Level: +X-Spam-Status: No, score=-0.044 tagged_above=-999 required=5 + tests=[AWL=-0.044] 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 Fi7jsl57tU3y for ; + Wed, 9 Dec 2015 18:16:43 -0800 (PST) +Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) + by arlo.cworth.org (Postfix) with ESMTP id BA1056DE005F + for ; Wed, 9 Dec 2015 18:16:42 -0800 (PST) +Received: from fifthhorseman.net (unknown [38.109.115.130]) + by che.mayfirst.org (Postfix) with ESMTPSA id 7002CF984 + for ; Wed, 9 Dec 2015 21:16:40 -0500 (EST) +Received: by fifthhorseman.net (Postfix, from userid 1000) + id 53061207F2; Wed, 9 Dec 2015 21:16:40 -0500 (EST) +From: Daniel Kahn Gillmor +To: Notmuch Mail +Subject: [PATCH v2] add notmuch.Database.get_status_string() +Date: Wed, 9 Dec 2015 21:16:40 -0500 +Message-Id: <1449713800-25608-1-git-send-email-dkg@fifthhorseman.net> +X-Mailer: git-send-email 2.6.2 +In-Reply-To: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net> +References: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net> +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:16:45 -0000 + +This gives some additional access to debugging information when using +the python bindings. +--- + bindings/python/notmuch/database.py | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py +index 5b58e09..d29c292 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,17 @@ 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() ++ s = Database._get_status_string(self._db) ++ if s: ++ return s.decode('utf-8', 'ignore') ++ return s ++ + def __repr__(self): + return "'Notmuch DB " + self.get_path() + "'" + +-- +2.6.2 +