summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas NOEL <tnoel@entrouvert.com>2014-08-07 15:25:31 (GMT)
committerThomas NOEL <tnoel@entrouvert.com>2014-08-07 15:25:31 (GMT)
commitbaba3c00e065e975ce11e11dd5f57988010bb1bd (patch)
tree65442fe20c1595c7d5fb69ac34bc8c74d1fb747c
parent19495535ab8b8141019404f5eeabb1f2d1c8c78d (diff)
downloadunivnautes-old-baba3c00e065e975ce11e11dd5f57988010bb1bd.zip
univnautes-old-baba3c00e065e975ce11e11dd5f57988010bb1bd.tar.gz
univnautes-old-baba3c00e065e975ce11e11dd5f57988010bb1bd.tar.bz2
fix discojuice geo strange format
geo can be a list of dict, or a dict.
-rwxr-xr-xvirtualenv/pffedportal/create_loginhtml.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/virtualenv/pffedportal/create_loginhtml.py b/virtualenv/pffedportal/create_loginhtml.py
index 75c2880..00ea5d3 100755
--- a/virtualenv/pffedportal/create_loginhtml.py
+++ b/virtualenv/pffedportal/create_loginhtml.py
@@ -66,8 +66,11 @@ n = 0
idps = []
for provider in LibertyProvider.objects.all():
n += 1
- geo = geo_idps.get(provider.entity_id, {}).get('geo',
- {'lat': 47.0+2.0*math.sin(n), 'lon': 2.5+3.0*math.cos(n)})
+ geo = geo_idps.get(provider.entity_id, {}).get('geo')
+ if isinstance(geo, list) and geo:
+ geo = geo[0]
+ if not geo:
+ geo = {'lat': 47.0+2.0*math.sin(n), 'lon': 2.5+3.0*math.cos(n)}
idps.append({
'entityid': provider.entity_id,
'name': get_ui_displayname(provider),