mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 17:51:06 -03:30
Switch base class for StateConflict
This fixes the output format for the 409 exception return
This commit is contained in:
@@ -12,7 +12,7 @@ from django.contrib.auth.models import User
|
|||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
from rest_framework.exceptions import ParseError, PermissionDenied, APIException
|
from rest_framework.exceptions import ParseError, PermissionDenied, ValidationError
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
from awx.main.utils import * # noqa
|
from awx.main.utils import * # noqa
|
||||||
@@ -57,9 +57,8 @@ access_registry = {
|
|||||||
# ...
|
# ...
|
||||||
}
|
}
|
||||||
|
|
||||||
class StateConflict(APIException):
|
class StateConflict(ValidationError):
|
||||||
status_code = 409
|
status_code = 409
|
||||||
default_detail = 'Object state is not correct'
|
|
||||||
|
|
||||||
def register_access(model_class, access_class):
|
def register_access(model_class, access_class):
|
||||||
access_classes = access_registry.setdefault(model_class, [])
|
access_classes = access_registry.setdefault(model_class, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user