[PATCH] add notmuch.Database.get_status_string()

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 18:12:53 PST 2015


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



More information about the notmuch mailing list