NotmuchError(STATUS.NULL_POINTER)
self._query = query_p
+ def set_sort(self, sort):
+ """notmuch_query_set_sort
+
+ :param sort: one of Query.SORT_OLDEST_FIRST|SORT_NEWEST_FIRST|SORT_MESSAGE_ID
+ :returns: Nothing, but raises NotmuchError if query is not inited
+ """
+ if self._query is None:
+ raise NotmuchError(STATUS.NOT_INITIALIZED)
+
+ nmlib.notmuch_query_set_sort(self._query, sort)
def search_messages(self):
"""notmuch_query_search_messages
querystr = quote_query_line(sys.argv[2:])
logging.debug("search-term "+querystr)
db = Database()
- q = Query(db,querystr)
- #TODO: notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);
- m = q.search_messages()
+ m = Query(db,querystr).search_messages()
print("\n".join([t for t in m.collect_tags()]))
elif sys.argv[1] == 'dump':
+ #TODO: implement "dump <filename>"
db = Database()
- msgs = Query(db,'').search_messages()
- for msg in msgs:
+ q = Query(db,'')
+ q.set_sort(Query.SORT_MESSAGE_ID)
+ m = q.search_messages()
+ for msg in m:
print("%s (%s)" % (msg.get_message_id(), msg.get_tags()))
else: