mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +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:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user