X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fdatabase.py;h=93e7b7a1cb64d8ffa7aa8607bb679546d995ed2d;hb=1fcbf095828dc91423f61a290887fe244750bf8a;hp=5b58e099b1fde6d692f047d0e32c4ccd9ae0493f;hpb=f5db7ad7d243785c274a99734c681e69d13313d0;p=notmuch diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 5b58e099..93e7b7a1 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -36,7 +36,6 @@ from .errors import ( NotmuchError, NullPointerError, NotInitializedError, - ReadOnlyDatabaseError, ) from .message import Message from .tag import Tags @@ -575,6 +574,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() + "'"