From 544099101301462c3f171cecb35eb7f792dc9502 Mon Sep 17 00:00:00 2001 From: jansenk Date: Fri, 13 Oct 2023 13:20:52 -0400 Subject: [PATCH] fix: recover serializer lost in merge --- openassessment/xblock/ui_mixins/mfe/mixin.py | 4 ++-- .../xblock/ui_mixins/mfe/submission_serializers.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openassessment/xblock/ui_mixins/mfe/mixin.py b/openassessment/xblock/ui_mixins/mfe/mixin.py index 291f1b7cb8..97ed81f52b 100644 --- a/openassessment/xblock/ui_mixins/mfe/mixin.py +++ b/openassessment/xblock/ui_mixins/mfe/mixin.py @@ -23,7 +23,7 @@ from openassessment.xblock.ui_mixins.mfe.constants import error_codes, handler_suffixes from openassessment.xblock.ui_mixins.mfe.ora_config_serializer import OraBlockInfoSerializer from openassessment.xblock.ui_mixins.mfe.page_context_serializer import PageDataSerializer -from openassessment.xblock.ui_mixins.mfe.serializers.submission_serializers import UploadFileRequestSerializer +from openassessment.xblock.ui_mixins.mfe.submission_serializers import AddFileRequestSerializer class OraApiException(JsonHandlerError): @@ -137,7 +137,7 @@ def _get_new_file_from_list(self, file_to_add, new_list): return None def _file_add(self, data): - serializer = UploadFileRequestSerializer(data=data) + serializer = AddFileRequestSerializer(data=data) if not serializer.is_valid(): raise OraApiException(400, error_codes.INCORRECT_PARAMETERS, serializer.errors) file_to_add = serializer.validated_data diff --git a/openassessment/xblock/ui_mixins/mfe/submission_serializers.py b/openassessment/xblock/ui_mixins/mfe/submission_serializers.py index 5cf1def7bc..280e6bfece 100644 --- a/openassessment/xblock/ui_mixins/mfe/submission_serializers.py +++ b/openassessment/xblock/ui_mixins/mfe/submission_serializers.py @@ -107,3 +107,13 @@ def get_response(self, data): if data['workflow']['has_submitted']: return SubmissionSerializer(data['response']).data return InProgressResponseSerializer(data).data + + +class AddFileRequestSerializer(Serializer): + """ + Input serializer for file/add handler + """ + fileDescription = CharField(source='description') + fileName = CharField(source='name') + fileSize = IntegerField(source='size', min_value=0) + contentType = CharField()