]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/notmuch/database.py
Implement Message.tags_to_maildir_flags
[notmuch] / bindings / python / notmuch / database.py
index fc7edf0b57f572007f726eacd1ef5586e91a655a..9016f0ae997d0cac1ea54af54e3fb04d71c9ee78 100644 (file)
@@ -273,6 +273,9 @@ class Database(object):
         notmuch database will reference the filename, and will not copy the
         entire contents of the file.
 
+        If the message contains Maildir flags, we will -depending on the
+        notmuch configuration- sync those tags to initial notmuch tags.
+
         :returns: On success, we return 
 
            1) a :class:`Message` object that can be used for things
@@ -310,11 +313,12 @@ class Database(object):
                                                   filename,
                                                   byref(msg_p))
  
-        if not status in [STATUS.SUCCESS,STATUS.DUPLICATE_MESSAGE_ID]:
+        if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:
             raise NotmuchError(status)
 
-        #construct Message() and return
+        #construct Message(), sync initial tags from Maildir flags and return
         msg = Message(msg_p, self)
+        msg.maildir_flags_to_tags()
         return (msg, status)
 
     def remove_message(self, filename):
@@ -358,8 +362,14 @@ class Database(object):
 
         :param msgid: The message ID
         :type msgid: string
-        :returns: :class:`Message` or `None` if no message is found or if an
-                  out-of-memory situation occurs.
+        :returns: :class:`Message` or `None` if no message is found or
+                  if any xapian exception or out-of-memory situation
+                  occurs. Do note that Xapian Exceptions include
+                  "Database modified" situations, e.g. when the
+                  notmuch database has been modified by
+                  another program in the meantime. A return value of 
+                  `None` is therefore no guarantee that the message 
+                  does not exist.
         :exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if
                   the database was not intitialized.
         """