mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
python: deprecated add_message calls index_file correctly and returns result
The deprecated Database.add_message now calls the new index_file with correct number of arguments (without an extra `self`), and returns the tuple from index_file - as it used to do before. This change also adds a DeprecationWarning to the function.
This commit is contained in:
parent
4366895062
commit
227ecf4949
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import codecs
|
import codecs
|
||||||
|
import warnings
|
||||||
from ctypes import c_char_p, c_void_p, c_uint, byref, POINTER
|
from ctypes import c_char_p, c_void_p, c_uint, byref, POINTER
|
||||||
from .compat import SafeConfigParser
|
from .compat import SafeConfigParser
|
||||||
from .globals import (
|
from .globals import (
|
||||||
|
@ -471,7 +472,10 @@ class Database(object):
|
||||||
def add_message(self, filename, sync_maildir_flags=False):
|
def add_message(self, filename, sync_maildir_flags=False):
|
||||||
"""Deprecated alias for :meth:`index_file`
|
"""Deprecated alias for :meth:`index_file`
|
||||||
"""
|
"""
|
||||||
self.index_file(self, filename, sync_maildir_flags=sync_maildir_flags)
|
warnings.warn(
|
||||||
|
"This function is deprecated and will be removed in the future, use index_file.", DeprecationWarning)
|
||||||
|
|
||||||
|
return self.index_file(filename, sync_maildir_flags=sync_maildir_flags)
|
||||||
|
|
||||||
_remove_message = nmlib.notmuch_database_remove_message
|
_remove_message = nmlib.notmuch_database_remove_message
|
||||||
_remove_message.argtypes = [NotmuchDatabaseP, c_char_p]
|
_remove_message.argtypes = [NotmuchDatabaseP, c_char_p]
|
||||||
|
|
Loading…
Reference in a new issue