else:
self.create(path)
+ def _verify_initialized_db(self):
+ """Raises a NotmuchError in case self._db is still None"""
+ if self._db is None:
+ raise NotmuchError(STATUS.NOT_INITIALIZED)
+
def create(self, path):
"""Creates a new notmuch database
"""Returns the file path of an open database
Wraps notmuch_database_get_path"""
+ # Raise a NotmuchError if not initialized
+ self._verify_initialized_db()
+
return Database._get_path(self._db)
def get_version(self):
:exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
the database was not intitialized.
"""
- if self._db is None:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ # Raise a NotmuchError if not initialized
+ self._verify_initialized_db()
return Database._get_version (self._db)
:exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
the database was not intitialized.
"""
- if self._db is None:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ # Raise a NotmuchError if not initialized
+ self._verify_initialized_db()
return notmuch_database_needs_upgrade(self.db)
:exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
the database was not intitialized.
"""
- if self._db is None:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ # Raise a NotmuchError if not initialized
+ self._verify_initialized_db()
+
msg_p = Database._find_message(self._db, msgid)
if msg_p is None:
return None
:returns: :class:`Tags`
:execption: :exc:`NotmuchError` with STATUS.NULL_POINTER on error
"""
- if self._db is None:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ # Raise a NotmuchError if not initialized
+ self._verify_initialized_db()
tags_p = Database._get_all_tags (self._db)
if tags_p == None: