From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gAeTK4652WF/AQEAgWs5BA (envelope-from ) for ; Sat, 08 Jan 2022 17:19:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AGfeKI652WGJVgEA9RJhRA (envelope-from ) for ; Sat, 08 Jan 2022 17:19:26 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7068219662 for ; Sat, 8 Jan 2022 17:19:26 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 514A45F71C; Sat, 8 Jan 2022 16:19:22 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id E0E5C5F717 for ; Sat, 8 Jan 2022 16:19:18 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 2967A5FC42; Sat, 8 Jan 2022 11:19:18 -0500 (EST) Received: (nullmailer pid 3117611 invoked by uid 1000); Sat, 08 Jan 2022 16:19:17 -0000 From: David Bremner To: Lele Gaifax , notmuch@notmuchmail.org Subject: [PATCH] bindings/python-cffi: search for config by default Date: Sat, 8 Jan 2022 12:19:13 -0400 Message-Id: <20220108161913.3117598-1-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <87fsqijx7u.fsf@metapensiero.it> References: <87fsqijx7u.fsf@metapensiero.it> MIME-Version: 1.0 Message-ID-Hash: 2FMCKK6H4XU2RD5OFIR6NEKWI3PBLZY6 X-Message-ID-Hash: 2FMCKK6H4XU2RD5OFIR6NEKWI3PBLZY6 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641658766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Qt51CppzErLQA9IissnZdF+4M4vbSgcc82MQ/Qj89Jo=; b=c4N0RpdDDZu1MRFktEFFPLW08fhhTRpFjEio8bXm60mxofcE/hC2TywvL0jboh5Vs4AwoL oj9GMYVsU193xzgVb4giYBUqrT1H01LY4V3o3EjEVFPXnNzOy6rk2+0mXlG5Bp1UFX1Zyv V2tKEqe4Lui+k+ZrlCC0O0F2E7uKvDmmSwMmrVKD3FkrIcyR/bZs3YyiibWKFGgDqyGoyj OBpi208YDQXhe0WsOHKt/8GfD73Wc30KGFV/OTXySVItTJF6c/Ls19ont+iEUjLMyVWbta aMyP3476377yEwkhGiXI/mqXZcrMziYW1Nndut681cosrhwUyxGMyifuzx/1iQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641658766; a=rsa-sha256; cv=none; b=QfM0D5QMFZmb5Tf/VVDb3g46cPxcYl6ovdflvdzJpznK+2TNIJWTuE0ZvZSu34ORwCAqkN lG/EKF6A1T93kjmhgmVxcr4blo/ZMmvHoPji8B/H8x9cj4dhk7YZrfz7M4AR4XLlEwtiYI OpyAHIzOlfIZt5TDXitopMWfgjtulBA7RblhFMvJOkZJSF2PcTXBVEA7lB+5xuN3z0ysI6 iM9ivuPJ0dzjlh57XMUWSqqVrEcNUO0aJ7LsVDAB9TnS1N6vUpqzjwJNShGtz8jaxP5nrF ptn9r2QCs5jcMtN7nwbZRxzbGOtbEt5Dh2JsRUrfBjTBmChaQF9o5/RnSH4Ncw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.29 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7068219662 X-Spam-Score: -1.29 X-Migadu-Scanner: scn1.migadu.com X-TUID: R/WEAoGDXqQn The previous (pre-0.34.2) constructor searched for a config file but only if the database path was not specified, and only to retrieve database.path. Neither of the available options (CONFIG.SEARCH or CONFIG.NONE) matches this semantics exactly, but CONFIG.SEARCH causes less breakage for people who relied on the old behaviour to set their database.path [1]. Since it also seems like the friendlier option in the long run, this commit switches to CONFIG.SEARCH as default. [1]: id:87fsqijx7u.fsf@metapensiero.it --- bindings/python-cffi/notmuch2/_database.py | 2 +- bindings/python-cffi/tests/test_database.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/python-cffi/notmuch2/_database.py b/bindings/python-cffi/notmuch2/_database.py index 14a8f15c..d7485b4d 100644 --- a/bindings/python-cffi/notmuch2/_database.py +++ b/bindings/python-cffi/notmuch2/_database.py @@ -139,7 +139,7 @@ class Database(base.NotmuchObject): path = os.fsencode(path) return path - def __init__(self, path=None, mode=MODE.READ_ONLY, config=CONFIG.EMPTY): + def __init__(self, path=None, mode=MODE.READ_ONLY, config=CONFIG.SEARCH): if isinstance(mode, str): mode = self.STR_MODE_MAP[mode] self.mode = mode diff --git a/bindings/python-cffi/tests/test_database.py b/bindings/python-cffi/tests/test_database.py index 9b3219c0..473723d5 100644 --- a/bindings/python-cffi/tests/test_database.py +++ b/bindings/python-cffi/tests/test_database.py @@ -13,7 +13,7 @@ import notmuch2._message as message @pytest.fixture def db(maildir): - with dbmod.Database.create(maildir.path) as db: + with dbmod.Database.create(maildir.path, config=notmuch2.Database.CONFIG.SEARCH) as db: yield db -- 2.34.1