From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id EFF586DE0931 for ; Wed, 30 Aug 2017 01:16:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.042 X-Spam-Level: X-Spam-Status: No, score=-0.042 tagged_above=-999 required=5 tests=[AWL=-0.022, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lm9bv08I7oID for ; Wed, 30 Aug 2017 01:16:46 -0700 (PDT) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by arlo.cworth.org (Postfix) with ESMTPS id 6C17D6DE00DB for ; Wed, 30 Aug 2017 01:16:46 -0700 (PDT) Received: by mail-lf0-f47.google.com with SMTP id d17so21777482lfe.1 for ; Wed, 30 Aug 2017 01:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaute-vetsj-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wBwNBORoORyilUYuRbs4FHhYGSbAT1XF3wMh2LBjeCU=; b=as9bSyWPDgyIeYBdLWHFvAZ3PaNVbsemxnUobpe/NzE2KSNTCtxVD394sv8hT2zZ+/ tnb0Jhp4u7yLFIYZPkVGVaGBVCqArQYYiVvYOgs6dFdeL591qOuFdBJZCu9kyVW/B4Y1 0kGSANcI2T+h6Qmf4y3u9aUOj/cdEPvfyabJqaJSo53S/8k0aARZ+KB//aRiTw0VEUes PdRFC93SrRHr2TCEBSxrzk0Ed4Leah62YHabRzud9wXo+Vbzi3U0d9v5fffOptRBU81+ D7catPbvp7mlLj9aOlh3gVmyb3v/FN3J0zpMlStzWvUtWaw80vi6EwJfa25LT8/5FCM2 IRPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wBwNBORoORyilUYuRbs4FHhYGSbAT1XF3wMh2LBjeCU=; b=G7q7ymusty/8rfYdG1Ph6YfTp9LaMy+i3Om89Bn+YdLWWqdNmQ/zvMFR8bjp5nHQZ3 aRYLaiKzKVftOlQGuG4TCA1FtEYy+o76oljt59/9kIXYq9xmzrBp/w8OYWF5MCWF0+RA /own0JlF7/pv534rdqNP8ieYBscYz+iaM3Ca+JWK5wmPkKvNpU+z2Fhk809j5hAiYXuk 82misSySNCY/ZEoeoZQL5qkdD71lQxGqQnlOnBeGoLddfHLGWktrmzExFgeMIb6lUQ51 GWvEtO0zOLoeO+vxtKRqYl/VrrBXOI1BSCJwij8qF6Px/8KK4J/z6jZJ5QLgdv/Q547H NSXw== X-Gm-Message-State: AHPjjUjEdCbZOZ2ntuJS9W5XcKG4UTvFpGS5NC0g9/OsqqUeN+UhBtdu ndTOWLidC0TgNCDFkYDGNQ== X-Received: by 10.25.178.66 with SMTP id b63mr346269lff.184.1504081004322; Wed, 30 Aug 2017 01:16:44 -0700 (PDT) Received: from localhost (cm-84.215.128.252.getinternet.no. [84.215.128.252]) by smtp.gmail.com with ESMTPSA id a9sm978849ljf.27.2017.08.30.01.16.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 01:16:43 -0700 (PDT) From: Gaute Hope To: notmuch@notmuchmail.org Subject: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result Date: Wed, 30 Aug 2017 10:16:33 +0200 Message-Id: <20170830081633.17616-1-eg@gaute.vetsj.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170828073923.31442-1-eg@gaute.vetsj.com> References: <20170828073923.31442-1-eg@gaute.vetsj.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 08:16:48 -0000 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. --- bindings/python/notmuch/database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index a2c025eb..1279804a 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -19,6 +19,7 @@ Copyright 2010 Sebastian Spaeth import os import codecs +import warnings from ctypes import c_char_p, c_void_p, c_uint, byref, POINTER from .compat import SafeConfigParser from .globals import ( @@ -471,7 +472,10 @@ class Database(object): def add_message(self, filename, sync_maildir_flags=False): """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.argtypes = [NotmuchDatabaseP, c_char_p] -- 2.14.1