Commit ee65efc6 authored by Serge S. Koval's avatar Serge S. Koval

Fixed #569. Properly handle model updates with image field on python 3

parent 2a5b7db2
......@@ -181,9 +181,10 @@ class FileUploadField(fields.TextField):
map(lambda x: x.lower(), self.allowed_extensions))
def pre_validate(self, form):
if (self.data and
isinstance(self.data, FileStorage) and
not self.is_file_allowed(self.data.filename)):
if (self.data
and len(self.data.filename)
and isinstance(self.data, FileStorage)
and not self.is_file_allowed(self.data.filename)):
raise ValidationError(gettext('Invalid file extension'))
def process(self, formdata, data=unset_value):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment