Commits

Thomas Johansson committed e1a464e

Fix a bug in optional validator that breaks it when using non-string fields such as file uploads. Thanks to kaelten for the report.

  • Participants
  • Parent commits 33cbf69

Comments (0)

Files changed (1)

File wtforms/validators.py

     field_flags = ('optional', )
 
     def __call__(self, form, field):
-        if field.raw_data is None or not field.raw_data or not field.raw_data[0].strip():
+        if not field.raw_data or isinstance(field.raw_data[0], basestring) and not field.raw_data[0].strip():
             field.errors[:] = []
             raise StopValidation()