X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fdatabase.py;h=67fb1c41142428ed6c06e36a985de8f1f784a1db;hb=3b760413c5fb42fb461f2f22711dcde9e92964b2;hp=5b58e099b1fde6d692f047d0e32c4ccd9ae0493f;hpb=ce44657c9e4919b1e4bbbbbe37dbd72257d40736;p=notmuch
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 5b58e099..67fb1c41 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -12,7 +12,7 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
-along with notmuch. If not, see .
+along with notmuch. If not, see .
Copyright 2010 Sebastian Spaeth
"""
@@ -36,7 +36,6 @@ from .errors import (
NotmuchError,
NullPointerError,
NotInitializedError,
- ReadOnlyDatabaseError,
)
from .message import Message
from .tag import Tags
@@ -484,7 +483,10 @@ class Database(object):
removed.
"""
self._assert_db_is_initialized()
- return self._remove_message(self._db, _str(filename))
+ status = self._remove_message(self._db, _str(filename))
+ if status not in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:
+ raise NotmuchError(status)
+ return status
def find_message(self, msgid):
"""Returns a :class:`Message` as identified by its message ID
@@ -575,6 +577,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() + "'"