From 633e7f0b8c57a1573cb8e58824e36207871181dd Mon Sep 17 00:00:00 2001 From: Alexander Pace <alexander.pace@ligo.org> Date: Wed, 18 Dec 2019 14:08:54 -0600 Subject: [PATCH] Update view_utils.py: It looks like the previous check that determined if the file_version was None is broken in python3: https://stackoverflow.com/questions/8961005/comparing-none-with-built-in-types-using-arithmetic-operators So the comparison of log.file_version=None >=0 would error out. I added the conditional to the top of the block and combined a couple of lines. --- gracedb/events/view_utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gracedb/events/view_utils.py b/gracedb/events/view_utils.py index 3ad0477ad..6dd15101a 100644 --- a/gracedb/events/view_utils.py +++ b/gracedb/events/view_utils.py @@ -375,10 +375,8 @@ def eventLogToDict(log, request=None): taglist_uri = api_reverse("events:eventlogtag-list", args=[log.event.graceid, log.N], request=request) - if log.filename: - actual_filename = log.filename - if log.file_version >= 0: - actual_filename += ',%d' % log.file_version + if log.filename and log.file_version is not None: + actual_filename = log.filename + ',%d' % log.file_version # NOTE: the reverse function will return a urlquoted # result, so we don't need urlquote here. Effectively # escaping twice results in wrong urls. -- GitLab