From 34da018fafa3df59b9bbbedad0472615c6ab6dd6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 21 Jan 2007 15:13:57 +0000 Subject: [PATCH] don't try to read ACE option before configure file is read. import gnome keyring after config file is read. fixes #2917 --- src/common/passwords.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/common/passwords.py b/src/common/passwords.py index badabce11..77ddbf8c9 100644 --- a/src/common/passwords.py +++ b/src/common/passwords.py @@ -18,17 +18,7 @@ from common import gajim USER_HAS_GNOMEKEYRING = False USER_USES_GNOMEKEYRING = False -if gajim.config.get('use_gnomekeyring'): - try: - import gnomekeyring - except ImportError: - pass - else: - USER_HAS_GNOMEKEYRING = True - if gnomekeyring.is_available(): - USER_USES_GNOMEKEYRING = True - else: - USER_USES_GNOMEKEYRING = False +gnomekeyring = None class PasswordStorage(object): def get_password(self, account_name): @@ -102,6 +92,20 @@ storage = None def get_storage(): global storage if storage is None: # None is only in first time get_storage is called + if gajim.config.get('use_gnomekeyring'): + global gnomekeyring + try: + import gnomekeyring + except ImportError: + pass + else: + global USER_HAS_GNOMEKEYRING + global USER_USES_GNOMEKEYRING + USER_HAS_GNOMEKEYRING = True + if gnomekeyring.is_available(): + USER_USES_GNOMEKEYRING = True + else: + USER_USES_GNOMEKEYRING = False if USER_USES_GNOMEKEYRING: try: storage = GnomePasswordStorage()