remove print, do 80char and use _()

This commit is contained in:
Nikos Kouremenos 2006-10-05 23:54:37 +00:00
parent 42f52bcd66
commit e620b4bff3
1 changed files with 5 additions and 6 deletions

View File

@ -41,27 +41,26 @@ class GnomePasswordStorage(object):
def get_password(self, account_name): def get_password(self, account_name):
conf = gajim.config.get_per('accounts', account_name, 'password') conf = gajim.config.get_per('accounts', account_name, 'password')
try: try:
unused, auth_token = conf.split("gnomekeyring:") unused, auth_token = conf.split('gnomekeyring:')
auth_token = int(auth_token) auth_token = int(auth_token)
print "load: token for account %s: %i" % (account_name, auth_token)
except ValueError: except ValueError:
password = conf password = conf
## migrate the password over to keyring ## migrate the password over to keyring
self.save_password(account_name, password, update=False) self.save_password(account_name, password, update=False)
return password return password
try: try:
return gnomekeyring.item_get_info_sync(self.keyring, auth_token).get_secret() return gnomekeyring.item_get_info_sync(self.keyring,
auth_token).get_secret()
except gnomekeyring.DeniedError: except gnomekeyring.DeniedError:
return None return None
def save_password(self, account_name, password, update=True): def save_password(self, account_name, password, update=True):
display_name = ("Gajim account %s" % (account_name,)) display_name = _('Gajim account %s') % account_name
attributes = dict(account_name=str(account_name), gajim=1) attributes = dict(account_name=str(account_name), gajim=1)
auth_token = gnomekeyring.item_create_sync( auth_token = gnomekeyring.item_create_sync(
self.keyring, gnomekeyring.ITEM_GENERIC_SECRET, self.keyring, gnomekeyring.ITEM_GENERIC_SECRET,
display_name, attributes, password, update) display_name, attributes, password, update)
print "save(update=%i): token for account %s: %i" % (update, account_name, auth_token) token = 'gnomekeyring:%i' % (auth_token,)
token = "gnomekeyring:%i" % (auth_token,)
gajim.config.set_per('accounts', account_name, 'password', token) gajim.config.set_per('accounts', account_name, 'password', token)