From 0735b18d9221c03104d605723b6b81a19ffcc6fb Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 11 Sep 2021 18:48:59 -0400 Subject: [PATCH] Simply set the default collection and reference it when needed. --- keyring/backends/libsecret.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyring/backends/libsecret.py b/keyring/backends/libsecret.py index 5b4fbd96..51d7f630 100644 --- a/keyring/backends/libsecret.py +++ b/keyring/backends/libsecret.py @@ -40,6 +40,7 @@ class Keyring(KeyringBackend): "username": Secret.SchemaAttributeType.STRING, }, ) + collection = Secret.COLLECTION_DEFAULT @properties.ClassProperty @classmethod @@ -77,7 +78,6 @@ def get_password(self, service, username): def set_password(self, service, username, password): """Set password for the username of the service""" - collection = getattr(self, 'preferred_collection', Secret.COLLECTION_DEFAULT) attributes = { "application": self.appid, "service": service, @@ -86,7 +86,7 @@ def set_password(self, service, username, password): label = "Password for '{}' on '{}'".format(username, service) try: stored = Secret.password_store_sync( - self.schema, attributes, collection, label, password, None + self.schema, attributes, self.collection, label, password, None ) except GLib.Error as error: quark = GLib.quark_try_string('secret-error')