[gjc] ask password when gnomekeyring isn't available. fixes #2834

This commit is contained in:
Yann Leboulanger 2006-12-27 21:13:42 +00:00
parent e816b38a0f
commit 447ec9ecd6
1 changed files with 14 additions and 10 deletions

View File

@ -37,7 +37,11 @@ class PasswordStorage(object):
class SimplePasswordStorage(PasswordStorage):
def get_password(self, account_name):
return gajim.config.get_per('accounts', account_name, 'password')
passwd = gajim.config.get_per('accounts', account_name, 'password')
if passwd.startswith('gnomekeyring:'):
return None # this is not a real password, it's a gnome keyring token
else:
return passwd
def save_password(self, account_name, password):
gajim.config.set_per('accounts', account_name, 'password', password)
@ -45,15 +49,15 @@ class SimplePasswordStorage(PasswordStorage):
class GnomePasswordStorage(PasswordStorage):
def __init__(self):
# self.keyring = gnomekeyring.get_default_keyring_sync()
## above line commented and code below inserted as workaround
## for the bug http://bugzilla.gnome.org/show_bug.cgi?id=363019
self.keyring = "default"
try:
gnomekeyring.create_sync(self.keyring, None)
except gnomekeyring.AlreadyExistsError:
def __init__(self):
# self.keyring = gnomekeyring.get_default_keyring_sync()
## above line commented and code below inserted as workaround
## for the bug http://bugzilla.gnome.org/show_bug.cgi?id=363019
self.keyring = "default"
try:
gnomekeyring.create_sync(self.keyring, None)
except gnomekeyring.AlreadyExistsError:
pass
def get_password(self, account_name):