diff options
author | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2011-06-24 08:44:06 +0200 |
---|---|---|
committer | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2011-06-24 08:44:06 +0200 |
commit | e59eaa5ddd2c23742c95e2acd34673b58ea34d2d (patch) | |
tree | 9fe527609852987029398c3e00c62e740cd900f0 /bindings/python/notmuch/database.py | |
parent | 68a2c7a8b0f749cb33a8ce7cfa2aa7781d2529bb (diff) |
python: Do not implicitely call maildir_flags_to_tags etc
In order to remain consistent with the underlying C API, we do not
automatically synchronize notmuch tags and maildir flags anymore.
The underlying functions Message.maildir_flags_to_tags and
Message.tags_to_maildir_flags still exist and are available to the user.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Diffstat (limited to 'bindings/python/notmuch/database.py')
-rw-r--r-- | bindings/python/notmuch/database.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 926bac6..5deb2a5 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -261,10 +261,10 @@ class Database(object): # return the Directory, init it with the absolute path return Directory(abs_dirpath, dir_p, self) - def add_message(self, filename): + def add_message(self, filename, sync_maildir_flags=False): """Adds a new message to the database - `filename` should be a path relative to the path of the open + :param filename: should be a path relative to the path of the open database (see :meth:`get_path`), or else should be an absolute filename with initial components that match the path of the database. @@ -274,8 +274,12 @@ 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. + :param sync_maildir_flags: If the message contains Maildir + flags, we will -depending on the notmuch configuration- sync + those tags to initial notmuch tags, if set to `True`. It is + `False` by default to remain consistent with the libnotmuch + API. You might want to look into the underlying method + :meth:`Message.maildir_flags_to_tags`. :returns: On success, we return @@ -317,9 +321,11 @@ class Database(object): if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]: raise NotmuchError(status) - #construct Message(), sync initial tags from Maildir flags and return + #construct Message() and return msg = Message(msg_p, self) - msg.maildir_flags_to_tags() + #automatic sync initial tags from Maildir flags + if sync_maildir_flags: + msg.maildir_flags_to_tags() return (msg, status) def remove_message(self, filename): |