Skip to content

Commit

Permalink
style: fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Nov 7, 2023
1 parent a50e08f commit e975107
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openedx_tagging/core/tagging/rest_api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,18 @@ class TaxonomyImportBodySerializer(serializers.Serializer): # pylint: disable=a
"""
file = serializers.FileField(required=True)

def validate(self, data):
def validate(self, attrs):
"""
Validates the file extension and add parser_format to the data
"""
filename = data["file"].name
filename = attrs["file"].name
ext = filename.split('.')[-1]
parser_format = getattr(ParserFormat, ext.upper(), None)
if not parser_format:
raise serializers.ValidationError({"file": f'File type not supported: {ext.lower()}'}, 'file')

data['parser_format'] = parser_format
return data
attrs['parser_format'] = parser_format
return attrs

class TaxonomyImportNewBodySerializer(TaxonomyImportBodySerializer): # pylint: disable=abstract-method
"""
Expand Down

0 comments on commit e975107

Please sign in to comment.