X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fhomeview.py;h=ae45ee1266df8846457edde8c857081f0bb9a4ae;hb=64769354aff47027420cbca4052cb39740fd7186;hp=d46ed651cb464b9f1d6926f867e101a493af9022;hpb=af9c96c4208f22ad874c604cf1045758bc7a5284;p=myslice.git diff --git a/portal/homeview.py b/portal/homeview.py index d46ed651..ae45ee12 100644 --- a/portal/homeview.py +++ b/portal/homeview.py @@ -101,15 +101,17 @@ class HomeView (FreeAccessView, ThemeView): ## check user is pi or not platform_query = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled') account_query = Query().get('local:account').select('user_id','platform_id','auth_type','config') + # XXX Something like an invalid session seems to make the execute fail sometimes, and thus gives an error on the main page platform_details = execute_query(self.request, platform_query) account_details = execute_query(self.request, account_query) for platform_detail in platform_details: for account_detail in account_details: - if platform_detail['platform_id'] == account_detail['platform_id']: - if 'config' in account_detail and account_detail['config'] is not '': - account_config = json.loads(account_detail['config']) - if 'myslice' in platform_detail['platform']: - acc_auth_cred = account_config.get('delegated_authority_credentials','N/A') + if 'platform_id' in platform_details: + if platform_detail['platform_id'] == account_detail['platform_id']: + if 'config' in account_detail and account_detail['config'] is not '': + account_config = json.loads(account_detail['config']) + if 'myslice' in platform_detail['platform']: + acc_auth_cred = account_config.get('delegated_authority_credentials','N/A') # assigning values if acc_auth_cred=={} or acc_auth_cred=='N/A': pi = "is_not_pi"