From e24fd291229adab7dacaf6225ff7bbab2e142896 Mon Sep 17 00:00:00 2001 From: Tanner Prestegard <tanner.prestegard@ligo.org> Date: Tue, 5 Feb 2019 15:08:22 -0600 Subject: [PATCH] Serialized event should always include search Previously if an Event did not have a Search, no 'search' key was included in the serialized event dictionary. Now we include one and set it to None if the Event has no Search. --- gracedb/events/view_utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gracedb/events/view_utils.py b/gracedb/events/view_utils.py index 505763a6b..b462a21b8 100644 --- a/gracedb/events/view_utils.py +++ b/gracedb/events/view_utils.py @@ -139,13 +139,18 @@ def eventToDict(event, columns=None, request=None, is_alert=False): rv['group'] = event.group.name rv['graceid'] = graceid rv['pipeline'] = event.pipeline.name - if event.search: - rv['search'] = event.search.name rv['gpstime'] = event.gpstime rv['instruments'] = event.instruments rv['nevents'] = event.nevents rv['offline'] = event.offline + # Search + if event.search: + search = event.search.name + else: + search = None + rv['search'] = search + far_is_upper_limit = False display_far = event.far if event.far and request and is_external(request.user): -- GitLab