Only check on csv is the file extension.

Update validator logic

Update message for the validator.
This commit is contained in:
Nicholas Staples
2016-04-29 15:40:35 +01:00
parent 1965537f30
commit f581ff44d0
3 changed files with 29 additions and 3 deletions

View File

@@ -20,8 +20,8 @@ class CsvFileValidator(object):
self.message = message
def __call__(self, form, field):
if not form.file.data.mimetype == 'text/csv':
raise ValidationError(self.message)
if not field.data.filename.lower().endswith('.csv'):
raise ValidationError("{} is not a CSV file".format(field.data.filename))
class ValidEmailDomainRegex(object):