def remove_all_tags(self): """Removes all tags from the given message. See :meth:`freeze` for an example showing how to safely replace tag values. :returns: STATUS.SUCCESS if the tags were successfully removed. Raises an exception otherwise. :exception: :exc:`NotmuchError`. They have the following meaning: STATUS.READ_ONLY_DATABASE Database was opened in read-only mode so message cannot be modified. STATUS.NOT_INITIALIZED The message has not been initialized. """ if self._msg is None: raise NotmuchError(STATUS.NOT_INITIALIZED) status = nmlib.notmuch_message_remove_all_tags(self._msg) if STATUS.SUCCESS == status: # return on success return status raise NotmuchError(status)
def remove_all_tags(self, sync_maildir_flags=False): """Removes all tags from the given message. See :meth:`freeze` for an example showing how to safely replace tag values. :param sync_maildir_flags: If notmuch configuration is set to do this, add maildir flags corresponding to notmuch tags. See :meth:`tags_to_maildir_flags`. Use False if you want to add/remove many tags on a message without having to physically rename the file every time. Do note, that this will do nothing when a message is frozen, as tag changes will not be committed to the database yet. :returns: STATUS.SUCCESS if the tags were successfully removed. Raises an exception otherwise. :exception: :exc:`NotmuchError`. They have the following meaning: STATUS.READ_ONLY_DATABASE Database was opened in read-only mode so message cannot be modified. STATUS.NOT_INITIALIZED The message has not been initialized. """ if self._msg is None: raise NotmuchError(STATUS.NOT_INITIALIZED) status = nmlib.notmuch_message_remove_all_tags(self._msg) # bail out on error if status != STATUS.SUCCESS: raise NotmuchError(status) if sync_maildir_flags: self.tags_to_maildir_flags() return STATUS.SUCCESS