mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
API fixes for 500 errors.
This commit is contained in:
parent
5b89c5e126
commit
a2595dcf12
@ -478,6 +478,10 @@ class BaseSerializer(serializers.ModelSerializer):
|
||||
return attrs
|
||||
|
||||
|
||||
class EmptySerializer(serializers.Serializer):
|
||||
pass
|
||||
|
||||
|
||||
class BaseFactSerializer(DocumentSerializer):
|
||||
|
||||
__metaclass__ = BaseSerializerMetaclass
|
||||
|
@ -1940,7 +1940,7 @@ class JobTemplateSurveySpec(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
parent_model = JobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
@ -2019,8 +2019,8 @@ class JobTemplateActivityStreamList(SubListAPIView):
|
||||
class JobTemplateCallback(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
permission_classes = (JobTemplateCallbackPermission,)
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
@csrf_exempt
|
||||
@transaction.non_atomic_requests
|
||||
@ -2202,7 +2202,7 @@ class SystemJobTemplateDetail(RetrieveAPIView):
|
||||
class SystemJobTemplateLaunch(GenericAPIView):
|
||||
|
||||
model = SystemJobTemplate
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return Response({})
|
||||
@ -2273,7 +2273,7 @@ class JobActivityStreamList(SubListAPIView):
|
||||
class JobStart(GenericAPIView):
|
||||
|
||||
model = Job
|
||||
# FIXME: Add serializer class to define fields in OPTIONS request!
|
||||
serializer_class = EmptySerializer
|
||||
is_job_start = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
@ -34,7 +34,10 @@ def handle_error(request, status=404, **kwargs):
|
||||
status_code = status
|
||||
default_detail = kwargs['content']
|
||||
api_error_view = ApiErrorView.as_view(view_name=kwargs['name'], exception_class=APIException)
|
||||
return api_error_view(request)
|
||||
response = api_error_view(request)
|
||||
if hasattr(response, 'render'):
|
||||
response.render()
|
||||
return response
|
||||
else:
|
||||
kwargs['content'] = format_html('<span class="nocode">{}</span>', kwargs.get('content', ''))
|
||||
return render(request, 'error.html', kwargs, status=status)
|
||||
|
Loading…
Reference in New Issue
Block a user