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()