From: Daniel Kahn Gillmor Date: Thu, 10 Dec 2015 02:18:17 +0000 (+1900) Subject: Re: [PATCH v2] add notmuch.Database.get_status_string() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=76911a98cb4ee03357e348f312b177b0656a27fe;p=notmuch-archives.git Re: [PATCH v2] add notmuch.Database.get_status_string() --- diff --git a/c1/97fb613ee905afeb8fe8b666907b42cd55531c b/c1/97fb613ee905afeb8fe8b666907b42cd55531c new file mode 100644 index 000000000..5954a3298 --- /dev/null +++ b/c1/97fb613ee905afeb8fe8b666907b42cd55531c @@ -0,0 +1,103 @@ +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 4F3576DE1603 + for ; Wed, 9 Dec 2015 18:18:22 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.039 +X-Spam-Level: +X-Spam-Status: No, score=-0.039 tagged_above=-999 required=5 + tests=[AWL=-0.039] 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 fmqKl7Oe_AFY for ; + Wed, 9 Dec 2015 18:18:20 -0800 (PST) +Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) + by arlo.cworth.org (Postfix) with ESMTP id 08D066DE005F + for ; Wed, 9 Dec 2015 18:18:19 -0800 (PST) +Received: from fifthhorseman.net (unknown [38.109.115.130]) + by che.mayfirst.org (Postfix) with ESMTPSA id 482D5F984 + for ; Wed, 9 Dec 2015 21:18:17 -0500 (EST) +Received: by fifthhorseman.net (Postfix, from userid 1000) + id 6D7C22006D; Wed, 9 Dec 2015 21:18:17 -0500 (EST) +From: Daniel Kahn Gillmor +To: Notmuch Mail +Subject: Re: [PATCH v2] add notmuch.Database.get_status_string() +In-Reply-To: <1449713800-25608-1-git-send-email-dkg@fifthhorseman.net> +References: <1449713573-25316-1-git-send-email-dkg@fifthhorseman.net> + <1449713800-25608-1-git-send-email-dkg@fifthhorseman.net> +User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Wed, 09 Dec 2015 21:18:17 -0500 +Message-ID: <87wpsnm4gm.fsf@alice.fifthhorseman.net> +MIME-Version: 1.0 +Content-Type: text/plain +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:18:22 -0000 + +Sorry about the first version, which didn't handle a NULL value +properly. Please only consider this v2 version. + + --dkg + +On Wed 2015-12-09 21:16:40 -0500, Daniel Kahn Gillmor wrote: +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> https://notmuchmail.org/mailman/listinfo/notmuch