Fixes #899 : DeprecationWarning about Required going away in WTForms 3.0. Replaced...
authorLoïc Le Ninan <loic.leninan@gmail.com>
Mon, 9 Jun 2014 13:14:23 +0000 (15:14 +0200)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 13 Jun 2014 15:23:07 +0000 (10:23 -0500)
mediagoblin/edit/forms.py
mediagoblin/meddleware/csrf.py
mediagoblin/plugins/basic_auth/forms.py
mediagoblin/plugins/ldap/forms.py
mediagoblin/plugins/oauth/forms.py
mediagoblin/plugins/openid/forms.py
mediagoblin/plugins/persona/forms.py
mediagoblin/plugins/piwigo/forms.py
mediagoblin/submit/forms.py
mediagoblin/user_pages/forms.py

index 7c390a3faa6c89ccfd466ef21609503ad5a85f2c..c0bece8b7e972bb2231d230bac47240c70f99d7f 100644 (file)
@@ -40,7 +40,7 @@ class EditForm(wtforms.Form):
             "Separate tags by commas."))
     slug = wtforms.TextField(
         _('Slug'),
-        [wtforms.validators.Required(message=_("The slug can't be empty"))],
+        [wtforms.validators.InputRequired(message=_("The slug can't be empty"))],
         description=_(
             "The title part of this media's address. "
             "You usually don't need to change this."))
@@ -87,7 +87,7 @@ class EditAttachmentsForm(wtforms.Form):
 class EditCollectionForm(wtforms.Form):
     title = wtforms.TextField(
         _('Title'),
-        [wtforms.validators.Length(min=0, max=500), wtforms.validators.Required(message=_("The title can't be empty"))])
+        [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired(message=_("The title can't be empty"))])
     description = wtforms.TextAreaField(
         _('Description of this collection'),
         description=_("""You can use
@@ -95,7 +95,7 @@ class EditCollectionForm(wtforms.Form):
                       Markdown</a> for formatting."""))
     slug = wtforms.TextField(
         _('Slug'),
-        [wtforms.validators.Required(message=_("The slug can't be empty"))],
+        [wtforms.validators.InputRequired(message=_("The slug can't be empty"))],
         description=_(
             "The title part of this collection's address. "
             "You usually don't need to change this."))
@@ -104,12 +104,12 @@ class EditCollectionForm(wtforms.Form):
 class ChangePassForm(wtforms.Form):
     old_password = wtforms.PasswordField(
         _('Old password'),
-        [wtforms.validators.Required()],
+        [wtforms.validators.InputRequired()],
         description=_(
             "Enter your old password to prove you own this account."))
     new_password = wtforms.PasswordField(
         _('New password'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          wtforms.validators.Length(min=6, max=30)],
         id="password")
 
@@ -117,11 +117,11 @@ class ChangePassForm(wtforms.Form):
 class ChangeEmailForm(wtforms.Form):
     new_email = wtforms.TextField(
         _('New email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
     password = wtforms.PasswordField(
         _('Password'),
-        [wtforms.validators.Required()],
+        [wtforms.validators.InputRequired()],
         description=_(
             "Enter your password to prove you own this account."))
 
index 44d42d75740f8c5fe42c0d3b2b08d22ba2bf4c77..6cad6fa76d1a161ed6982b4adb8cbd668c5471ac 100644 (file)
@@ -46,7 +46,7 @@ class CsrfForm(Form):
     is included in the POST."""
 
     csrf_token = HiddenField("",
-                             [validators.Required()])
+                             [validators.InputRequired()])
 
 
 def render_csrf_form_token(request):
index c10496f88b26dae41343d5d646321df7faa00299..42b84bf32fba25dbe8e75e92115e37eb1496a864 100644 (file)
@@ -22,22 +22,22 @@ from mediagoblin.auth.tools import normalize_user_or_email_field
 class RegistrationForm(wtforms.Form):
     username = wtforms.TextField(
         _('Username'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_email=False)])
     password = wtforms.PasswordField(
         _('Password'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          wtforms.validators.Length(min=5, max=1024)])
     email = wtforms.TextField(
         _('Email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
 
 
 class LoginForm(wtforms.Form):
     username = wtforms.TextField(
         _('Username or Email'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field()])
     password = wtforms.PasswordField(
         _('Password'))
@@ -49,28 +49,28 @@ class LoginForm(wtforms.Form):
 class ForgotPassForm(wtforms.Form):
     username = wtforms.TextField(
         _('Username or email'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field()])
 
 
 class ChangeForgotPassForm(wtforms.Form):
     password = wtforms.PasswordField(
         'Password',
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          wtforms.validators.Length(min=5, max=1024)])
     token = wtforms.HiddenField(
         '',
-        [wtforms.validators.Required()])
+        [wtforms.validators.InputRequired()])
 
 
 class ChangePassForm(wtforms.Form):
     old_password = wtforms.PasswordField(
         _('Old password'),
-        [wtforms.validators.Required()],
+        [wtforms.validators.InputRequired()],
         description=_(
             "Enter your old password to prove you own this account."))
     new_password = wtforms.PasswordField(
         _('New password'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          wtforms.validators.Length(min=6, max=30)],
         id="password")
index 7ec1479e737ca96a0fc01b2d99e96d0a90793ec5..1f1439abe40fe8111ce073af0d49d29cb381b5d1 100644 (file)
@@ -22,19 +22,19 @@ from mediagoblin.auth.tools import normalize_user_or_email_field
 class RegisterForm(wtforms.Form):
     username = wtforms.HiddenField(
         '',
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_email=False)])
     email = wtforms.TextField(
         _('Email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
 
 
 class LoginForm(wtforms.Form):
     username = wtforms.TextField(
         _('Username'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field()])
     password = wtforms.PasswordField(
         _('Password'),
-        [wtforms.validators.Required()])
+        [wtforms.validators.InputRequired()])
index 5edd992a509a991676d0fd569b70248ce9806472..ddf4d3905d5f6ef37f373fe73009ae12e134a2ed 100644 (file)
@@ -24,21 +24,21 @@ from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
 
 class AuthorizationForm(wtforms.Form):
     client_id = wtforms.HiddenField(u'',
-                                    validators=[wtforms.validators.Required()])
-    next = wtforms.HiddenField(u'', validators=[wtforms.validators.Required()])
+                                    validators=[wtforms.validators.InputRequired()])
+    next = wtforms.HiddenField(u'', validators=[wtforms.validators.InputRequired()])
     allow = wtforms.SubmitField(_(u'Allow'))
     deny = wtforms.SubmitField(_(u'Deny'))
 
 
 class ClientRegistrationForm(wtforms.Form):
-    name = wtforms.TextField(_('Name'), [wtforms.validators.Required()],
+    name = wtforms.TextField(_('Name'), [wtforms.validators.InputRequired()],
             description=_('The name of the OAuth client'))
     description = wtforms.TextAreaField(_('Description'),
             [wtforms.validators.Length(min=0, max=500)],
             description=_('''This will be visible to users allowing your
                 application to authenticate as them.'''))
     type = wtforms.SelectField(_('Type'),
-            [wtforms.validators.Required()],
+            [wtforms.validators.InputRequired()],
             choices=[
                 ('confidential', 'Confidential'),
                 ('public', 'Public')],
index f26024bdb2df1874a8d5b179e4b6b110ea819a68..d47369dcf8f632dd6f9bed97cfca29d468fd4e0e 100644 (file)
@@ -22,20 +22,20 @@ from mediagoblin.auth.tools import normalize_user_or_email_field
 class RegistrationForm(wtforms.Form):
     openid = wtforms.HiddenField(
         '',
-        [wtforms.validators.Required()])
+        [wtforms.validators.InputRequired()])
     username = wtforms.TextField(
         _('Username'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_email=False)])
     email = wtforms.TextField(
         _('Email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
 
 
 class LoginForm(wtforms.Form):
     openid = wtforms.TextField(
         _('OpenID'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          # Can openid's only be urls?
          wtforms.validators.URL(message='Please enter a valid url.')])
index 608be0c7a1f57f6d2cd232b407f4e83ea92abc4e..7d6323445adaee9300910ab6f6b8f4eec15518fe 100644 (file)
@@ -22,20 +22,20 @@ from mediagoblin.auth.tools import normalize_user_or_email_field
 class RegistrationForm(wtforms.Form):
     username = wtforms.TextField(
         _('Username'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_email=False)])
     email = wtforms.TextField(
         _('Email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
     persona_email = wtforms.HiddenField(
         '',
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
 
 
 class EditForm(wtforms.Form):
     email = wtforms.TextField(
         _('Email address'),
-        [wtforms.validators.Required(),
+        [wtforms.validators.InputRequired(),
          normalize_user_or_email_field(allow_user=False)])
index fb04aa6a3bd5facb225cb38c29253f6656ca414c..fd545a3efcfc466cb53c4151361b543cb467e13d 100644 (file)
@@ -34,7 +34,7 @@ _md5_validator = wtforms.validators.Regexp(r"^[0-9a-fA-F]{32}$")
 class AddForm(wtforms.Form):
     original_sum = wtforms.TextField(None,
         [_md5_validator,
-         wtforms.validators.Required()])
+         wtforms.validators.InputRequired()])
     thumbnail_sum = wtforms.TextField(None,
         [wtforms.validators.Optional(),
          _md5_validator])
index e226464524d2e78abd663b613bfd97060d560532..6c0e8e9c6427431faa033e3f78f2091b0fb4d090 100644 (file)
@@ -59,7 +59,7 @@ def get_submit_start_form(form, **kwargs):
 class AddCollectionForm(wtforms.Form):
     title = wtforms.TextField(
         _('Title'),
-        [wtforms.validators.Length(min=0, max=500), wtforms.validators.Required()])
+        [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired()])
     description = wtforms.TextAreaField(
         _('Description of this collection'),
         description=_("""You can use
index eb786f47b6f51d16317610530956c4de9493f7df..1a09864b704ecceca3964b74094cb44adc151a8f 100644 (file)
@@ -21,7 +21,7 @@ from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
 class MediaCommentForm(wtforms.Form):
     comment_content = wtforms.TextAreaField(
         _('Comment'),
-        [wtforms.validators.Required()],
+        [wtforms.validators.InputRequired()],
         description=_(u'You can use '
                       u'<a href="http://daringfireball.net/projects/markdown/basics" target="_blank">'
                       u'Markdown</a> for formatting.'))
@@ -53,11 +53,11 @@ class MediaCollectForm(wtforms.Form):
 class CommentReportForm(wtforms.Form):
     report_reason = wtforms.TextAreaField(
         _('Reason for Reporting'),
-        [wtforms.validators.Required()])
+        [wtforms.validators.InputRequired()])
     reporter_id = wtforms.HiddenField('')
 
 class MediaReportForm(wtforms.Form):
     report_reason = wtforms.TextAreaField(
         _('Reason for Reporting'),
-        [wtforms.validators.Required()])
+        [wtforms.validators.InputRequired()])
     reporter_id = wtforms.HiddenField('')