handle latitude and logitude set to None
diff --git a/xos/core/views/legacyapi.py b/xos/core/views/legacyapi.py
index 4657116..1466e90 100644
--- a/xos/core/views/legacyapi.py
+++ b/xos/core/views/legacyapi.py
@@ -121,6 +121,13 @@
for ps_node in ps_site.nodes.all():
node_ids.append(ps_id_to_pl_id(ps_node.id))
+ if ps_site.location:
+ longitude = ps_site.location.longitude
+ latitude = ps_site.location.latitude
+ else:
+ longitude = 0
+ latitude = 0
+
site = {"site_id": ps_id_to_pl_id(ps_site.id),
"node_ids": node_ids,
"pcu_ids": [],
@@ -134,8 +141,8 @@
"url": None,
"site_tag_ids": [],
"enabled": True,
- "longitude": float(ps_site.location.longitude),
- "latitude": float(ps_site.location.latitude),
+ "longitude": float(longitude),
+ "latitude": float(latitude),
"slice_ids": slice_ids,
"login_base": ps_site.login_base,
"peer_id": None}