mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Clean up deprecated module removed in python 3.13 (#9004)
* Remove deprecated module removed in python 3.13 * Update validate to use helper function * Add translation wrapper to error message
This commit is contained in:
parent
56bfbfb1b4
commit
1912e754b4
@ -1,6 +1,5 @@
|
||||
"""DRF data serializers for Part app."""
|
||||
|
||||
import imghdr
|
||||
import io
|
||||
import os
|
||||
from decimal import Decimal
|
||||
@ -298,9 +297,9 @@ class PartThumbSerializerUpdate(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
|
||||
def validate_image(self, value):
|
||||
"""Check that file is an image."""
|
||||
validate = imghdr.what(value)
|
||||
validate = InvenTree.helpers.TestIfImage(value)
|
||||
if not validate:
|
||||
raise serializers.ValidationError('File is not an image')
|
||||
raise serializers.ValidationError(_('File is not an image'))
|
||||
return value
|
||||
|
||||
image = InvenTree.serializers.InvenTreeAttachmentSerializerField(required=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user