aboutsummaryrefslogtreecommitdiff
path: root/bindings/python
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2015-12-09 21:16:40 -0500
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-12-11 17:05:32 +0100
commit8881a61fe7a1956534b89cd1f79984793ff694fe (patch)
treee15b7197bf287d8c475b354e9662bc2628c06544 /bindings/python
parent88c0bc4cc6401b70c8a677edbc9a847de37c1e21 (diff)
python: add notmuch.Database.status_string()
This gives some additional access to debugging information when using the python bindings. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/notmuch/database.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 5b58e099..f7d04bf4 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -575,6 +575,22 @@ class Database(object):
"""
return Query(self, querystring)
+ """notmuch_database_status_string"""
+ _status_string = nmlib.notmuch_database_status_string
+ _status_string.argtypes = [NotmuchDatabaseP]
+ _status_string.restype = c_char_p
+
+ def 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._status_string(self._db)
+ if s:
+ return s.decode('utf-8', 'ignore')
+ return s
+
def __repr__(self):
return "'Notmuch DB " + self.get_path() + "'"