Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/web/accountsmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jarabe/web/accountsmanager.py')
-rw-r--r--src/jarabe/web/accountsmanager.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/jarabe/web/accountsmanager.py b/src/jarabe/web/accountsmanager.py
index cd1da83..fb7b632 100644
--- a/src/jarabe/web/accountsmanager.py
+++ b/src/jarabe/web/accountsmanager.py
@@ -21,13 +21,14 @@ import logging
from gi.repository import Gtk
from jarabe import config
+from jarabe.web.account import Account
_accounts = []
def get_all_accounts():
''' Returns a list of all installed online account managers '''
- global _accounts # No need to do this every time.
+ global _accounts
if len(_accounts) > 0:
return _accounts
@@ -54,8 +55,8 @@ def _load_module(dir_path):
for f in os.listdir(dir_path):
if f == 'account.py':
module_name = f[:-3]
- logging.debug('OnlineAccountsManager loading %s' % (
- module_name))
+ logging.debug('OnlineAccountsManager loading %s' %
+ (module_name))
module_path = 'web.%s.%s' % (os.path.basename(dir_path),
module_name)
try:
@@ -65,8 +66,8 @@ def _load_module(dir_path):
module = mod.get_account()
except Exception as e:
- logging.exception('Exception while loading %s: %s' % (
- module_name, str(e)))
+ logging.exception('Exception while loading %s: %s' %
+ (module_name, str(e)))
return module
@@ -90,8 +91,11 @@ def _extend_icon_theme_search_path(dir_path):
def get_configured_accounts():
- return [a for a in get_all_accounts() if a.is_configured()]
+ return [a for a in get_all_accounts()
+ if a.get_token_state() in (Account.STATE_VALID,
+ Account.STATE_EXPIRED)]
def get_active_accounts():
- return [a for a in get_all_accounts() if a.is_active()]
+ return [a for a in get_all_accounts()
+ if a.get_token_state() == Account.STATE_VALID]