summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
871fc32)
Before
3434d1940 the return values of libnotmuch functions were
declared as c_void_p and the code checking for errors compared the
returned value to None, which is the ctypes equivalent of a NULL
pointer.
But said commit wrapped all the data types in python classes and the
semantic changed in a subtle way. If a function returns NULL, the
wrapped python value is falsish, but no longer equal to None.
res = Database._create(_str(path), Database.MODE.READ_WRITE)
res = Database._create(_str(path), Database.MODE.READ_WRITE)
raise NotmuchError(
message="Could not create the specified database")
self._db = res
raise NotmuchError(
message="Could not create the specified database")
self._db = res
"""
res = Database._open(_str(path), mode)
"""
res = Database._open(_str(path), mode)
raise NotmuchError(message="Could not open the specified database")
self._db = 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))
self._db = db
# create query, return None if too little mem available
query_p = Query._create(db.db_p, _str(querystr))
raise NullPointerError
self._query = query_p
raise NullPointerError
self._query = query_p
self._assert_query_is_initialized()
threads_p = Query._search_threads(self._query)
self._assert_query_is_initialized()
threads_p = Query._search_threads(self._query)
raise NullPointerError
return Threads(threads_p, self)
raise NullPointerError
return Threads(threads_p, self)
self._assert_query_is_initialized()
msgs_p = Query._search_messages(self._query)
self._assert_query_is_initialized()
msgs_p = Query._search_messages(self._query)
raise NullPointerError
return Messages(msgs_p, self)
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"""
def _assert_dir_is_initialized(self):
"""Raises a NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)
if dir_p is None"""
- if self._dir_p is None:
raise NotmuchError(STATUS.NOT_INITIALIZED)
def __init__(self, path, dir_p, parent):
raise NotmuchError(STATUS.NOT_INITIALIZED)
def __init__(self, path, dir_p, parent):
_move_to_next.restype = None
def __next__(self):
_move_to_next.restype = None
def __next__(self):
- if self._files_p is None:
raise NotmuchError(STATUS.NOT_INITIALIZED)
if not self._valid(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
"""
# NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)
for file in files: print file
"""
- if self._files_p is None:
raise NotmuchError(STATUS.NOT_INITIALIZED)
i = 0
raise NotmuchError(STATUS.NOT_INITIALIZED)
i = 0
reference to it, so we can automatically delete the db object
once all derived objects are dead.
"""
reference to it, so we can automatically delete the db object
once all derived objects are dead.
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._files = files_p
raise NotmuchError(STATUS.NULL_POINTER)
self._files = files_p
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._msgs = msgs_p
raise NotmuchError(STATUS.NULL_POINTER)
self._msgs = msgs_p
automatically delete the parent object once all derived
objects are dead.
"""
automatically delete the parent object once all derived
objects are dead.
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._msg = msg_p
#keep reference to parent, so we keep it alive
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)
msgs_p = Message._get_replies(self._msg)
return EmptyMessagesResult(self)
return Messages(msgs_p, self)
return EmptyMessagesResult(self)
return Messages(msgs_p, self)
:TODO: Make the iterator optionally work more than once by
cache the tags in the Python object(?)
"""
:TODO: Make the iterator optionally work more than once by
cache the tags in the Python object(?)
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._tags = tags_p
raise NotmuchError(STATUS.NULL_POINTER)
self._tags = tags_p
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
:TODO: Make the iterator work more than once and cache the tags in
the Python object.(?)
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._threads = threads_p
raise NotmuchError(STATUS.NULL_POINTER)
self._threads = threads_p
automatically delete the parent object once all derived
objects are dead.
"""
automatically delete the parent object once all derived
objects are dead.
"""
raise NotmuchError(STATUS.NULL_POINTER)
self._thread = thread_p
#keep reference to parent, so we keep it alive
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)
msgs_p = Thread._get_toplevel_messages(self._thread)
raise NotmuchError(STATUS.NULL_POINTER)
return Messages(msgs_p, self)
raise NotmuchError(STATUS.NULL_POINTER)
return Messages(msgs_p, self)