From fe153395c372a503acffdd9f2249244a3579fba8 Mon Sep 17 00:00:00 2001
From: Branson Stephens <branson.stephens@ligo.org>
Date: Tue, 2 Dec 2014 11:36:26 -0600
Subject: [PATCH] Added checks that ra_min, ra_max, dec_min, dec_max fall
 within allowed boundaries.

---
 gracedb/view_logic.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gracedb/view_logic.py b/gracedb/view_logic.py
index 662347a74..9df10a7e3 100644
--- a/gracedb/view_logic.py
+++ b/gracedb/view_logic.py
@@ -383,7 +383,6 @@ def create_eel(d, event, user):
     gpsmin = 100000000000
     gpsmax = 0
     for i in range(nList):
-        print i
         try:
             ra = float(ratok[i])
         except:
@@ -416,6 +415,13 @@ def create_eel(d, event, user):
             raise ValueError('Cannot read duration list element %d'%i)
         if gps-w < gpsmin: gpsmin = gps-w
         if gps+w > gpsmax: gpsmax = gps+w
+
+    # Make sure the min/max ra and dec are within bounds:
+    ramin  = max(0.0,   ramin)
+    ramax  = min(360.0, ramax)
+    decmin = max(-90.0, decmin)
+    decmax = min(90.0,  decmax)
+
     eel.ra = (ramin+ramax)/2
     eel.raWidth = ramax-ramin
     eel.dec = (decmin+decmax)/2
-- 
GitLab