]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/notmuch/database.py
Simplify (& fix) Message().__str__()
[notmuch] / bindings / python / notmuch / database.py
index 7f0091de583044b91d696f5646a15075a69c1d88..926bac63f5931882941238b866dc3b4ee5b14bc1 100644 (file)
@@ -100,6 +100,7 @@ class Database(object):
                 Database._std_db_path = self._get_user_default_db()
             path = Database._std_db_path
 
                 Database._std_db_path = self._get_user_default_db()
             path = Database._std_db_path
 
+        assert isinstance(path, basestring), 'Path needs to be a string or None.'
         if create == False:
             self.open(path, mode)
         else:
         if create == False:
             self.open(path, mode)
         else:
@@ -273,6 +274,9 @@ class Database(object):
         notmuch database will reference the filename, and will not copy the
         entire contents of the file.
 
         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
         :returns: On success, we return 
 
            1) a :class:`Message` object that can be used for things
@@ -310,11 +314,12 @@ class Database(object):
                                                   filename,
                                                   byref(msg_p))
  
                                                   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)
 
             raise NotmuchError(status)
 
-        #construct Message() and return
+        #construct Message(), sync initial tags from Maildir flags and return
         msg = Message(msg_p, self)
         msg = Message(msg_p, self)
+        msg.maildir_flags_to_tags()
         return (msg, status)
 
     def remove_message(self, filename):
         return (msg, status)
 
     def remove_message(self, filename):