From 3af360ecc07bbc54bd9f84fc5da2bdc7a75e20e1 Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <konrad.mohrfeldt@farbdev.org> Date: Sun, 24 Apr 2022 17:03:04 +0200 Subject: [PATCH] fix: align schedule create/update conflict responses with documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conflict responses should be send with an HTTP 409 status code as they’re defined in our documentation. This was not the case as the dashboard couldn’t handle these error codes, but is now fixed in https://gitlab.servus.at/aura/dashboard/-/commit/4a07ad9e58d2bf2755f78afb8e107a822dfec55c. --- program/views.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/program/views.py b/program/views.py index c000b10b..acd66207 100644 --- a/program/views.py +++ b/program/views.py @@ -487,8 +487,7 @@ class APIScheduleViewSet( try: resolution = Schedule.resolve_conflicts(request.data, pk, show_pk) except ScheduleConflictError as exc: - # TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it - return Response(exc.conflicts) + return Response(exc.conflicts, status.HTTP_409_CONFLICT) if all(key in resolution for key in ["create", "update", "delete"]): # this is a dry-run @@ -535,8 +534,7 @@ class APIScheduleViewSet( request.data, schedule.pk, schedule.show.pk ) except ScheduleConflictError as exc: - # TODO: respond with status.HTTP_409_CONFLICT when the dashboard can handle it - return Response(exc.conflicts) + return Response(exc.conflicts, status.HTTP_409_CONFLICT) return Response(resolution) -- GitLab