From b587b892b017b3ca0bcb70ee15237fce6983a50d Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 18 Jul 2016 12:27:53 -0400 Subject: [PATCH] Switch base class for StateConflict This fixes the output format for the 409 exception return --- awx/main/access.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index d3f8e50990..5b2ee91851 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -12,7 +12,7 @@ from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType # Django REST Framework -from rest_framework.exceptions import ParseError, PermissionDenied, APIException +from rest_framework.exceptions import ParseError, PermissionDenied, ValidationError # AWX from awx.main.utils import * # noqa @@ -57,9 +57,8 @@ access_registry = { # ... } -class StateConflict(APIException): +class StateConflict(ValidationError): status_code = 409 - default_detail = 'Object state is not correct' def register_access(model_class, access_class): access_classes = access_registry.setdefault(model_class, [])