From 0e04e30c67507335a06f816c341f165aef9afb15 Mon Sep 17 00:00:00 2001 From: "alexander.pace@ligo.org" <alexander.pace@ligo.org> Date: Sun, 24 Nov 2019 10:10:27 -0600 Subject: [PATCH] Two changes: 1) Fixed a 500 Internal Server error when removing labels from events that do not exist. Basically the ValueError.message method was depreciated in python3; replaced it with a str(error). 2) Bumped version to 2.8.0 --- config/settings/base.py | 2 +- gracedb/api/v1/events/views.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index 4b6f11031..4f26af00f 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -26,7 +26,7 @@ MAINTENANCE_MODE = False MAINTENANCE_MODE_MESSAGE = None # Version --------------------------------------------------------------------- -PROJECT_VERSION = '2.7.1-1' +PROJECT_VERSION = '2.8.0' # Unauthenticated access ------------------------------------------------------ # This variable should eventually control whether unauthenticated access is diff --git a/gracedb/api/v1/events/views.py b/gracedb/api/v1/events/views.py index 1f259dccd..c9b292c9b 100644 --- a/gracedb/api/v1/events/views.py +++ b/gracedb/api/v1/events/views.py @@ -798,7 +798,7 @@ class EventLabel(InheritPermissionsAPIView): try: rv, label_created = create_label(event, request, label) except (ValueError, Label.ProtectedLabelError) as e: - return Response(e.message, + return Response(str(e), status=status.HTTP_400_BAD_REQUEST) # Return response and status code @@ -813,9 +813,9 @@ class EventLabel(InheritPermissionsAPIView): try: rv = delete_label(event, request, label) except Labelling.DoesNotExist as e: - return Response(e.message, status=status.HTTP_404_NOT_FOUND) + return Response(str(e), status=status.HTTP_404_NOT_FOUND) except (ValueError, Label.ProtectedLabelError) as e: - return Response(e.message, status=status.HTTP_400_BAD_REQUEST) + return Response(str(e), status=status.HTTP_400_BAD_REQUEST) return Response(status=status.HTTP_204_NO_CONTENT) -- GitLab