From: Loic Baron <loic.baron@lip6.fr>
Date: Wed, 17 Jun 2015 16:24:00 +0000 (+0200)
Subject: getAuthorities handling exception if no result from Registry platform
X-Git-Tag: myslice-1.5
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ea9c5055160af2baa2affbb089de87b219598b6f;p=unfold.git

getAuthorities handling exception if no result from Registry platform
---

diff --git a/portal/actions.py b/portal/actions.py
index ec4b2888..523a9e1e 100644
--- a/portal/actions.py
+++ b/portal/actions.py
@@ -84,12 +84,15 @@ def getAuthorities(request, admin = False):
     # XXX theme has to be the same as the root authority 
     result = sfa_client(request,'List',hrn=theme.theme,object_type='authority',platforms=['myslice'],admin=admin)
     authorities = list()
-    for item in result['myslice']:
-        t_hrn = item['hrn'].split('.')
-        if 'name' in item:
-            authorities.append({'authority_hrn':item['hrn'], 'name':item['name'], 'shortname':t_hrn[-1].upper()})    
-        else:
-            authorities.append({'authority_hrn':item['hrn']})    
+    try:
+        for item in result['myslice']:
+            t_hrn = item['hrn'].split('.')
+            if 'name' in item:
+                authorities.append({'authority_hrn':item['hrn'], 'name':item['name'], 'shortname':t_hrn[-1].upper()})    
+            else:
+                authorities.append({'authority_hrn':item['hrn']})    
+    except:
+        logger.error(result)
     return sorted(authorities)