Skip to content

Commit

Permalink
Simply set the default collection and reference it when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 11, 2021
1 parent 5d0a375 commit 715154e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions keyring/backends/libsecret.py
Expand Up @@ -40,6 +40,7 @@ class Keyring(KeyringBackend):
"username": Secret.SchemaAttributeType.STRING,
},
)
collection = Secret.COLLECTION_DEFAULT

@properties.ClassProperty
@classmethod
Expand Down Expand Up @@ -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,
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion tests/backends/test_libsecret.py
Expand Up @@ -18,7 +18,7 @@ def init_keyring(self):
"password prompts are for this keyring"
)
keyring = libsecret.Keyring()
keyring.preferred_collection = 'session'
keyring.collection = 'session'
return keyring


Expand Down

0 comments on commit 715154e

Please sign in to comment.