Commits

Thomas Johansson committed 74752ff

Fix bug in optional validator failing when no raw_data is present. Thanks to zenom for the report.

Comments (0)

Files changed (1)

wtforms/validators.py

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