Commits

Stéphane Klein committed dbb9946

Bug fix #58 : FileField class don't work with validators.Required

Comments (0)

Files changed (1)

wtforms/validators.py

 import re
+from cgi import FieldStorage
 
 
 __all__ = (
         self.message = message
 
     def __call__(self, form, field):
+        if isinstance(field.data, FieldStorage) and field.data.file is not None:
+            return
+
         if not field.data or isinstance(field.data, basestring) and not field.data.strip():
             if self.message is None:
                 self.message = field.gettext(u'This field is required.')