res = Database._create(_str(path), Database.MODE.READ_WRITE)
- if res is None:
+ if not res:
raise NotmuchError(
message="Could not create the specified database")
self._db = res
"""
res = Database._open(_str(path), mode)
- if res is None:
+ if not res:
raise NotmuchError(message="Could not open the specified database")
self._db = res
self._db = db
# create query, return None if too little mem available
query_p = Query._create(db.db_p, _str(querystr))
- if query_p is None:
+ if not query_p:
raise NullPointerError
self._query = query_p
self._assert_query_is_initialized()
threads_p = Query._search_threads(self._query)
- if threads_p is None:
+ if not threads_p:
raise NullPointerError
return Threads(threads_p, self)
self._assert_query_is_initialized()
msgs_p = Query._search_messages(self._query)
- if msgs_p is None:
+ if not msgs_p:
raise NullPointerError
return Messages(msgs_p, self)
def _assert_dir_is_initialized(self):
"""Raises a NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)
if dir_p is None"""
- if self._dir_p is None:
+ if not self._dir_p:
raise NotmuchError(STATUS.NOT_INITIALIZED)
def __init__(self, path, dir_p, parent):
_move_to_next.restype = None
def next(self):
- if self._files_p is None:
+ if not self._files_p:
raise NotmuchError(STATUS.NOT_INITIALIZED)
if not self._valid(self._files_p):
# NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)
for file in files: print file
"""
- if self._files_p is None:
+ if not self._files_p:
raise NotmuchError(STATUS.NOT_INITIALIZED)
i = 0
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
- if msgs_p is None:
+ if not msgs_p:
raise NotmuchError(STATUS.NULL_POINTER)
self._msgs = msgs_p
automatically delete the parent object once all derived
objects are dead.
"""
- if msg_p is None:
+ if not msg_p:
raise NotmuchError(STATUS.NULL_POINTER)
self._msg = msg_p
#keep reference to parent, so we keep it alive
msgs_p = Message._get_replies(self._msg)
- if msgs_p is None:
+ if not msgs_p:
return None
return Messages(msgs_p, self)
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
- if threads_p is None:
+ if not threads_p:
raise NotmuchError(STATUS.NULL_POINTER)
self._threads = threads_p
automatically delete the parent object once all derived
objects are dead.
"""
- if thread_p is None:
+ if not thread_p:
raise NotmuchError(STATUS.NULL_POINTER)
self._thread = thread_p
#keep reference to parent, so we keep it alive
msgs_p = Thread._get_toplevel_messages(self._thread)
- if msgs_p is None:
+ if not msgs_p:
raise NotmuchError(STATUS.NULL_POINTER)
return Messages(msgs_p, self)