Catch exceptions from gnomekeyring - eg the daemon not running is one problem

This commit is contained in:
berrange@dhcp-5-251.virt.boston.redhat.com 2006-08-16 14:44:35 -04:00
parent ea583fe3a3
commit 3f3a3adc7e
1 changed files with 6 additions and 2 deletions

View File

@ -25,14 +25,18 @@ try:
import gnomekeyring
haveKeyring = True
except:
print "No support for gnome-keyring"
print _("No support for gnome-keyring")
pass
class vmmKeyring:
def __init__(self):
if haveKeyring:
self.keyring = gnomekeyring.get_default_keyring_sync()
try:
self.keyring = gnomekeyring.get_default_keyring_sync()
except:
print _("Keyring unavailable: '%s'") % (str((sys.exc_info())[0]) + " " + str((sys.exc_info())[1]))
self.keyring = None
else:
self.keyring = None