]> git.cworth.org Git - notmuch/blobdiff - cnotmuch/database.py
implement Query.set_sort() and sort notmuch dump by message id
[notmuch] / cnotmuch / database.py
index 8d6124cbc9e816a227b5d7dfeeaa3006519f44b3..09af0df964d15822e2606d76a64a68454fd2c9ba 100644 (file)
@@ -185,6 +185,16 @@ class Query(object):
             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