Commits

James Crasta committed 8158cb0

Fix issue with DataRequired validator caching the translation, causing issues with multi-lingual apps. Refs #161.

  • Participants
  • Parent commits 35c5f71

Comments (0)

Files changed (1)

File wtforms/validators.py

     def __call__(self, form, field):
         if not field.data or isinstance(field.data, string_types) and not field.data.strip():
             if self.message is None:
-                self.message = field.gettext('This field is required.')
+                message = field.gettext('This field is required.')
+            else:
+                message = self.message
 
             field.errors[:] = []
-            raise StopValidation(self.message)
+            raise StopValidation(message)
 
 
 class Required(DataRequired):