from notmuch.globals import (
nmlib,
STATUS,
+ FileError,
NotmuchError,
+ NullPointerError,
NotInitializedError,
Enum,
_str,
# we got an absolute path
if not path.startswith(self.get_path()):
# but its initial components are not equal to the db path
- raise NotmuchError(STATUS.FILE_ERROR,
- message="Database().get_directory() called "
- "with a wrong absolute path.")
+ raise FileError('Database().get_directory() called '
+ 'with a wrong absolute path')
abs_dirpath = path
else:
#we got a relative path, make it absolute
self._assert_db_is_initialized()
tags_p = Database._get_all_tags(self._db)
if tags_p == None:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return Tags(tags_p, self)
def create_query(self, querystring):
"""Raises a NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)
if dir_p is None"""
if not self._dir_p:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
def __init__(self, path, dir_p, parent):
"""
def __next__(self):
if not self._files_p:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
if not self._valid(self._files_p):
self._files_p = None
for file in files: print file
"""
if not self._files_p:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
i = 0
while self._valid(self._files_p):
Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'
"""
from ctypes import c_char_p
-from notmuch.globals import (nmlib, STATUS, NotmuchError,
- NotmuchFilenamesP, NotmuchMessageP, Python3StringMixIn)
+from notmuch.globals import (
+ nmlib,
+ NullPointerError,
+ NotInitializedError,
+ NotmuchMessageP,
+ NotmuchFilenamesP,
+ Python3StringMixIn,
+)
class Filenames(Python3StringMixIn):
iterator over a list of notmuch filenames. Do note that the underlying
library only provides a one-time iterator (it cannot reset the iterator to
the start). Thus iterating over the function will "exhaust" the list of
- tags, and a subsequent iteration attempt will raise a :exc:`NotmuchError`
- STATUS.NOT_INITIALIZED. Also note, that any function that uses iteration
- (nearly all) will also exhaust the tags. So both::
+ tags, and a subsequent iteration attempt will raise a
+ :exc:`NotInitializedError`. Also note, that any function that uses
+ iteration (nearly all) will also exhaust the tags. So both::
for name in filenames: print name
will almost never instantiate a :class:`Tags` object
herself. They are usually handed back as a result,
e.g. in :meth:`Database.get_all_tags`. *tags_p* must be
- valid, we will raise an :exc:`NotmuchError`
- (STATUS.NULL_POINTER) if it is `None`.
+ valid, we will raise an :exc:`NullPointerError`
+ if it is `None`.
:type files_p: :class:`ctypes.c_void_p`
:param parent: The parent object (ie :class:`Message` these
filenames are derived from, and saves a
once all derived objects are dead.
"""
if not files_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._files = files_p
#save reference to parent object so we keep it alive
This is the main function that will usually be used by the
user."""
if not self._files:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
while self._valid(self._files):
yield Filenames._get(self._files).decode('utf-8', 'ignore')
.. note:: As this iterates over the filenames, we will not be
able to iterate over them again (as in retrieve them)! If
the tags have been exhausted already, this will raise a
- :exc:`NotmuchError` STATUS.NOT_INITIALIZED on subsequent
+ :exc:`NotInitializedError` on subsequent
attempts. However, you can use
:meth:`Message.get_filenames` repeatedly to perform
various actions on filenames.
from ctypes import c_char_p, c_long, c_uint, c_int
from datetime import date
from notmuch.globals import (
- nmlib, STATUS, NotmuchError, Enum, _str, Python3StringMixIn,
- NotmuchTagsP, NotmuchMessagesP, NotmuchMessageP, NotmuchFilenamesP)
+ nmlib,
+ Enum,
+ _str,
+ Python3StringMixIn,
+ STATUS,
+ NotmuchError,
+ NullPointerError,
+ NotInitializedError,
+ NotmuchTagsP,
+ NotmuchMessageP,
+ NotmuchMessagesP,
+ NotmuchFilenamesP,
+)
from notmuch.tag import Tags
from notmuch.filename import Filenames
import sys
only provides a one-time iterator (it cannot reset the iterator to
the start). Thus iterating over the function will "exhaust" the list
of messages, and a subsequent iteration attempt will raise a
- :exc:`NotmuchError` STATUS.NOT_INITIALIZED. If you need to
+ :exc:`NotInitializedError`. If you need to
re-iterate over a list of messages you will need to retrieve a new
:class:`Messages` object or cache your :class:`Message`\s in a list
via::
will almost never instantiate a :class:`Messages` object
herself. They are usually handed back as a result,
e.g. in :meth:`Query.search_messages`. *msgs_p* must be
- valid, we will raise an :exc:`NotmuchError`
- (STATUS.NULL_POINTER) if it is `None`.
+ valid, we will raise an :exc:`NullPointerError` if it is
+ `None`.
:type msgs_p: :class:`ctypes.c_void_p`
:param parent: The parent object
(ie :class:`Query`) these tags are derived from. It saves
the Python object.(?)
"""
if not msgs_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._msgs = msgs_p
#store parent, so we keep them alive as long as self is alive
"""Return the unique :class:`Tags` in the contained messages
:returns: :class:`Tags`
- :exceptions: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if not init'ed
+ :exceptions: :exc:`NotInitializedError` if not init'ed
.. note::
will not allow further iterations.
"""
if not self._msgs:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
# collect all tags (returns NULL on error)
tags_p = Messages._collect_tags(self._msgs)
self._msgs = None
if tags_p == None:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return Tags(tags_p, self)
def __iter__(self):
def __next__(self):
if not self._msgs:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
if not self._valid(self._msgs):
self._msgs = None
def __init__(self, msg_p, parent=None):
"""
:param msg_p: A pointer to an internal notmuch_message_t
- Structure. If it is `None`, we will raise an :exc:`NotmuchError`
- STATUS.NULL_POINTER.
+ Structure. If it is `None`, we will raise an
+ :exc:`NullPointerError`.
:param parent: A 'parent' object is passed which this message is
derived from. We save a reference to it, so we can
objects are dead.
"""
if not msg_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._msg = msg_p
#keep reference to parent, so we keep it alive
self._parent = parent
"""Returns the message ID
:returns: String with a message ID
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._get_message_id(self._msg).decode('utf-8', 'ignore')
def get_thread_id(self):
message belongs to a single thread.
:returns: String with a thread ID
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._get_thread_id(self._msg).decode('utf-8', 'ignore')
an empty Messages iterator.
:returns: :class:`Messages`.
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
msgs_p = Message._get_replies(self._msg)
:returns: A time_t timestamp.
:rtype: c_unit64
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._get_date(self._msg)
def get_header(self, header):
It is not case-sensitive.
:type header: str
:returns: The header value as string
- :exception: :exc:`NotmuchError`
-
- * STATUS.NOT_INITIALIZED if the message
- is not initialized.
- * STATUS.NULL_POINTER if any error occured.
+ :raises: :exc:`NotInitializedError` if the message is not
+ initialized
+ :raises: :exc:`NullPointerError` if any error occured
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
#Returns NULL if any error occurs.
header = Message._get_header(self._msg, _str(header))
if header == None:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return header.decode('UTF-8', 'ignore')
def get_filename(self):
"""Returns the file path of the message file
:returns: Absolute file path & name of the message file
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._get_filename(self._msg).decode('utf-8', 'ignore')
def get_filenames(self):
messages recorded to have the same Message-ID. These files must
not necessarily have identical content."""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
files_p = Message._get_filenames(self._msg)
:param flag: One of the :attr:`Message.FLAG` values (currently only
*Message.FLAG.MATCH*
:returns: An unsigned int (0/1), indicating whether the flag is set.
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._get_flag(self._msg, flag)
def set_flag(self, flag, value):
:param value: A bool indicating whether to set or unset the flag.
:returns: Nothing
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
self._set_flag(self._msg, flag, value)
def get_tags(self):
"""Returns the message tags
:returns: A :class:`Tags` iterator.
- :exception: :exc:`NotmuchError`
-
- * STATUS.NOT_INITIALIZED if the message
- is not initialized.
- * STATUS.NULL_POINTER, on error
+ :raises: :exc:`NotInitializedError` if the message is not
+ initialized
+ :raises: :exc:`NullPointerError` if any error occured
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
tags_p = Message._get_tags(self._msg)
if tags_p == None:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return Tags(tags_p, self)
_add_tag = nmlib.notmuch_message_add_tag
:returns: STATUS.SUCCESS if the tag was successfully added.
Raises an exception otherwise.
- :exception: :exc:`NotmuchError`. They have the following meaning:
-
- STATUS.NULL_POINTER
- The 'tag' argument is NULL
- STATUS.TAG_TOO_LONG
- The length of 'tag' is too long
- (exceeds Message.NOTMUCH_TAG_MAX)
- STATUS.READ_ONLY_DATABASE
- Database was opened in read-only mode so message cannot be
- modified.
- STATUS.NOT_INITIALIZED
- The message has not been initialized.
- """
+ :raises: :exc:`NullPointerError` if the `tag` argument is NULL
+ :raises: :exc:`TagTooLongError` if the length of `tag` exceeds
+ Message.NOTMUCH_TAG_MAX)
+ :raises: :exc:`ReadOnlyDatabaseError` if the database was opened
+ in read-only mode so message cannot be modified
+ :raises: :exc:`NotInitializedError` if message has not been
+ initialized
+ """
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
status = self._add_tag(self._msg, _str(tag))
:returns: STATUS.SUCCESS if the tag was successfully removed or if
the message had no such tag.
Raises an exception otherwise.
- :exception: :exc:`NotmuchError`. They have the following meaning:
-
- STATUS.NULL_POINTER
- The 'tag' argument is NULL
- STATUS.TAG_TOO_LONG
- The length of 'tag' is too long
- (exceeds NOTMUCH_TAG_MAX)
- STATUS.READ_ONLY_DATABASE
- Database was opened in read-only mode so message cannot
- be modified.
- STATUS.NOT_INITIALIZED
- The message has not been initialized.
+ :raises: :exc:`NullPointerError` if the `tag` argument is NULL
+ :raises: :exc:`TagTooLongError` if the length of `tag` exceeds
+ Message.NOTMUCH_TAG_MAX)
+ :raises: :exc:`ReadOnlyDatabaseError` if the database was opened
+ in read-only mode so message cannot be modified
+ :raises: :exc:`NotInitializedError` if message has not been
+ initialized
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
status = self._remove_tag(self._msg, _str(tag))
# bail out on error
:returns: STATUS.SUCCESS if the tags were successfully removed.
Raises an exception otherwise.
- :exception: :exc:`NotmuchError`. They have the following meaning:
-
- STATUS.READ_ONLY_DATABASE
- Database was opened in read-only mode so message cannot
- be modified.
- STATUS.NOT_INITIALIZED
- The message has not been initialized.
+ :raises: :exc:`ReadOnlyDatabaseError` if the database was opened
+ in read-only mode so message cannot be modified
+ :raises: :exc:`NotInitializedError` if message has not been
+ initialized
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
status = self._remove_all_tags(self._msg)
:returns: STATUS.SUCCESS if the message was successfully frozen.
Raises an exception otherwise.
- :exception: :exc:`NotmuchError`. They have the following meaning:
-
- STATUS.READ_ONLY_DATABASE
- Database was opened in read-only mode so message cannot
- be modified.
- STATUS.NOT_INITIALIZED
- The message has not been initialized.
+ :raises: :exc:`ReadOnlyDatabaseError` if the database was opened
+ in read-only mode so message cannot be modified
+ :raises: :exc:`NotInitializedError` if message has not been
+ initialized
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
status = self._freeze(self._msg)
:returns: STATUS.SUCCESS if the message was successfully frozen.
Raises an exception otherwise.
- :exception: :exc:`NotmuchError`. They have the following meaning:
-
- STATUS.UNBALANCED_FREEZE_THAW
- An attempt was made to thaw an unfrozen message.
- That is, there have been an unbalanced number of calls
- to :meth:`freeze` and :meth:`thaw`.
- STATUS.NOT_INITIALIZED
- The message has not been initialized.
+ :raises: :exc:`UnbalancedFreezeThawError` if an attempt was made
+ to thaw an unfrozen message. That is, there have been
+ an unbalanced number of calls to :meth:`freeze` and
+ :meth:`thaw`.
+ :raises: :exc:`NotInitializedError` if message has not been
+ initialized
"""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
status = self._thaw(self._msg)
:returns: a :class:`STATUS` value. In short, you want to see
notmuch.STATUS.SUCCESS here. See there for details."""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._tags_to_maildir_flags(self._msg)
def maildir_flags_to_tags(self):
:returns: a :class:`STATUS`. In short, you want to see
notmuch.STATUS.SUCCESS here. See there for details."""
if not self._msg:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Message._tags_to_maildir_flags(self._msg)
def __repr__(self):
Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'
"""
from ctypes import c_char_p
-from notmuch.globals import nmlib, STATUS, NotmuchError, NotmuchTagsP, Python3StringMixIn
+from notmuch.globals import (
+ nmlib,
+ Python3StringMixIn,
+ NullPointerError,
+ NotInitializedError,
+ NotmuchTagsP,
+)
class Tags(Python3StringMixIn):
Do note that the underlying library only provides a one-time
iterator (it cannot reset the iterator to the start). Thus iterating
over the function will "exhaust" the list of tags, and a subsequent
- iteration attempt will raise a :exc:`NotmuchError`
- STATUS.NOT_INITIALIZED. Also note, that any function that uses
- iteration (nearly all) will also exhaust the tags. So both::
+ iteration attempt will raise a :exc:`NotInitializedError`.
+ Also note, that any function that uses iteration (nearly all) will
+ also exhaust the tags. So both::
for tag in tags: print tag
will almost never instantiate a :class:`Tags` object
herself. They are usually handed back as a result,
e.g. in :meth:`Database.get_all_tags`. *tags_p* must be
- valid, we will raise an :exc:`NotmuchError`
- (STATUS.NULL_POINTER) if it is `None`.
+ valid, we will raise an :exc:`NullPointerError` if it is
+ `None`.
:type tags_p: :class:`ctypes.c_void_p`
:param parent: The parent object (ie :class:`Database` or
:class:`Message` these tags are derived from, and saves a
cache the tags in the Python object(?)
"""
if not tags_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._tags = tags_p
#save reference to parent object so we keep it alive
def __next__(self):
if not self._tags:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
if not self._valid(self._tags):
self._tags = None
raise StopIteration
As this iterates over the tags, we will not be able to iterate over
them again (as in retrieve them)! If the tags have been exhausted
- already, this will raise a :exc:`NotmuchError`
- STATUS.NOT_INITIALIZED on subsequent attempts.
+ already, this will raise a :exc:`NotInitializedError`on subsequent
+ attempts.
"""
return " ".join(self)
"""
from ctypes import c_char_p, c_long, c_int
-from notmuch.globals import (nmlib, STATUS,
- NotmuchError, NotmuchThreadP, NotmuchThreadsP, NotmuchMessagesP,
- NotmuchTagsP, Python3StringMixIn)
+from notmuch.globals import (
+ nmlib,
+ Python3StringMixIn,
+ NullPointerError,
+ NotInitializedError,
+ NotmuchThreadP,
+ NotmuchThreadsP,
+ NotmuchMessagesP,
+ NotmuchTagsP,
+)
from notmuch.message import Messages
from notmuch.tag import Tags
from datetime import date
library only provides a one-time iterator (it cannot reset the
iterator to the start). Thus iterating over the function will
"exhaust" the list of threads, and a subsequent iteration attempt
- will raise a :exc:`NotmuchError` STATUS.NOT_INITIALIZED. Also
+ will raise a :exc:`NotInitializedError`. Also
note, that any function that uses iteration will also
exhaust the messages. So both::
will almost never instantiate a :class:`Threads` object
herself. They are usually handed back as a result,
e.g. in :meth:`Query.search_threads`. *threads_p* must be
- valid, we will raise an :exc:`NotmuchError`
- (STATUS.NULL_POINTER) if it is `None`.
+ valid, we will raise an :exc:`NullPointerError` if it is
+ `None`.
:type threads_p: :class:`ctypes.c_void_p`
:param parent: The parent object
(ie :class:`Query`) these tags are derived from. It saves
the Python object.(?)
"""
if not threads_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._threads = threads_p
#store parent, so we keep them alive as long as self is alive
def __next__(self):
if not self._threads:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
if not self._valid(self._threads):
self._threads = None
#THIS FAILS
threads = Database().create_query('').search_threads()
if len(threads) > 0: #this 'exhausts' threads
- # next line raises NotmuchError(STATUS.NOT_INITIALIZED)!!!
+ # next line raises :exc:`NotInitializedError`!!!
for thread in threads: print thread
"""
if not self._threads:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
i = 0
# returns 'bool'. On out-of-memory it returns None
will almost never instantiate a :class:`Thread` object
herself. They are usually handed back as a result,
e.g. when iterating through :class:`Threads`. *thread_p*
- must be valid, we will raise an :exc:`NotmuchError`
- (STATUS.NULL_POINTER) if it is `None`.
+ must be valid, we will raise an :exc:`NullPointerError`
+ if it is `None`.
:param parent: A 'parent' object is passed which this message is
derived from. We save a reference to it, so we can
objects are dead.
"""
if not thread_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
self._thread = thread_p
#keep reference to parent, so we keep it alive
self._parent = parent
for as long as the thread is valid.
:returns: String with a message ID
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thread
+ :exception: :exc:`NotInitializedError` if the thread
is not initialized.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Thread._get_thread_id(self._thread).decode('utf-8', 'ignore')
_get_total_messages = nmlib.notmuch_thread_get_total_messages
:returns: The number of all messages in the database
belonging to this thread. Contrast with
:meth:`get_matched_messages`.
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thread
+ :exception: :exc:`NotInitializedError` if the thread
is not initialized.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return self._get_total_messages(self._thread)
def get_toplevel_messages(self):
messages, etc.).
:returns: :class:`Messages`
- :exception: :exc:`NotmuchError`
-
- * STATUS.NOT_INITIALIZED if query is not inited
- * STATUS.NULL_POINTER if search_messages failed
+ :raises: :exc:`NotInitializedError` if query is not initialized
+ :raises: :exc:`NullPointerError` if search_messages failed
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
msgs_p = Thread._get_toplevel_messages(self._thread)
if not msgs_p:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return Messages(msgs_p, self)
:returns: The number of all messages belonging to this thread that
matched the :class:`Query`from which this thread was created.
Contrast with :meth:`get_total_messages`.
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thread
+ :exception: :exc:`NotInitializedError` if the thread
is not initialized.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return self._get_matched_messages(self._thread)
def get_authors(self):
as long as this Thread() is not deleted.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
authors = Thread._get_authors(self._thread)
if not authors:
return None
as long as this Thread() is not deleted.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
subject = Thread._get_subject(self._thread)
if not subject:
return None
:returns: A time_t timestamp.
:rtype: c_unit64
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Thread._get_newest_date(self._thread)
def get_oldest_date(self):
:returns: A time_t timestamp.
:rtype: c_unit64
- :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+ :exception: :exc:`NotInitializedError` if the message
is not initialized.
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
return Thread._get_oldest_date(self._thread)
def get_tags(self):
query from which it derived is explicitely deleted).
:returns: A :class:`Tags` iterator.
- :exception: :exc:`NotmuchError`
-
- * STATUS.NOT_INITIALIZED if the thread
- is not initialized.
- * STATUS.NULL_POINTER, on error
+ :raises: :exc:`NotInitializedError` if query is not initialized
+ :raises: :exc:`NullPointerError` if search_messages failed
"""
if not self._thread:
- raise NotmuchError(STATUS.NOT_INITIALIZED)
+ raise NotInitializedError()
tags_p = Thread._get_tags(self._thread)
if tags_p == None:
- raise NotmuchError(STATUS.NULL_POINTER)
+ raise NullPointerError()
return Tags(tags_p, self)
def __unicode__(self):