Skip to content

Commit

Permalink
fix: recover serializer lost in merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenk committed Oct 13, 2023
1 parent f4a8a1b commit 5440991
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openassessment/xblock/ui_mixins/mfe/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions openassessment/xblock/ui_mixins/mfe/submission_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 5440991

Please sign in to comment.