Remove implementation of FileSize validator

This commit is contained in:
Patrick Jentsch
2024-05-04 17:17:06 +02:00
parent 991810cff5
commit 4a29a52f2a
3 changed files with 2 additions and 17 deletions

View File

@ -1,14 +0,0 @@
from wtforms.validators import ValidationError
def FileSize(max_size_mb):
max_size_b = max_size_mb * 1024 * 1024
def file_length_check(form, field):
if len(field.data.read()) >= max_size_b:
raise ValidationError(
f'File size must be less or equal than {max_size_mb} MB'
)
field.data.seek(0)
return file_length_check