From 176a02e0f4c4945fb01a57aaa29bfa565111bda3 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 8 Aug 2007 16:10:38 +0000 Subject: [PATCH] fix gnomekeyring.DeniedError. fixes #3300 --- src/common/passwords.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/passwords.py b/src/common/passwords.py index 901adeb44..79d83cb16 100644 --- a/src/common/passwords.py +++ b/src/common/passwords.py @@ -81,9 +81,14 @@ class GnomePasswordStorage(PasswordStorage): def save_password(self, account_name, password, update=True): display_name = _('Gajim account %s') % account_name attributes = dict(account_name=str(account_name), gajim=1) - auth_token = gnomekeyring.item_create_sync( - self.keyring, gnomekeyring.ITEM_GENERIC_SECRET, - display_name, attributes, password, update) + try: + auth_token = gnomekeyring.item_create_sync( + self.keyring, gnomekeyring.ITEM_GENERIC_SECRET, + display_name, attributes, password, update) + except gnomekeyring.DeniedError: + set_storage(SimplePasswordStorage()) + storage.save_password(account_name, password) + return token = 'gnomekeyring:%i' % auth_token gajim.config.set_per('accounts', account_name, 'password', token) if gajim.connections.has_key(account_name):