From: Loïc Le Ninan Date: Mon, 9 Jun 2014 13:14:23 +0000 (+0200) Subject: Fixes #899 : DeprecationWarning about Required going away in WTForms 3.0. Replaced... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0742e11dff487e1af27652fcf63f7d53322018cd;p=mediagoblin.git Fixes #899 : DeprecationWarning about Required going away in WTForms 3.0. Replaced Required with InputRequired. --- diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index 7c390a3f..c0bece8b 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -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 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.")) diff --git a/mediagoblin/meddleware/csrf.py b/mediagoblin/meddleware/csrf.py index 44d42d75..6cad6fa7 100644 --- a/mediagoblin/meddleware/csrf.py +++ b/mediagoblin/meddleware/csrf.py @@ -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): diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py index c10496f8..42b84bf3 100644 --- a/mediagoblin/plugins/basic_auth/forms.py +++ b/mediagoblin/plugins/basic_auth/forms.py @@ -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") diff --git a/mediagoblin/plugins/ldap/forms.py b/mediagoblin/plugins/ldap/forms.py index 7ec1479e..1f1439ab 100644 --- a/mediagoblin/plugins/ldap/forms.py +++ b/mediagoblin/plugins/ldap/forms.py @@ -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()]) diff --git a/mediagoblin/plugins/oauth/forms.py b/mediagoblin/plugins/oauth/forms.py index 5edd992a..ddf4d390 100644 --- a/mediagoblin/plugins/oauth/forms.py +++ b/mediagoblin/plugins/oauth/forms.py @@ -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')], diff --git a/mediagoblin/plugins/openid/forms.py b/mediagoblin/plugins/openid/forms.py index f26024bd..d47369dc 100644 --- a/mediagoblin/plugins/openid/forms.py +++ b/mediagoblin/plugins/openid/forms.py @@ -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.')]) diff --git a/mediagoblin/plugins/persona/forms.py b/mediagoblin/plugins/persona/forms.py index 608be0c7..7d632344 100644 --- a/mediagoblin/plugins/persona/forms.py +++ b/mediagoblin/plugins/persona/forms.py @@ -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)]) diff --git a/mediagoblin/plugins/piwigo/forms.py b/mediagoblin/plugins/piwigo/forms.py index fb04aa6a..fd545a3e 100644 --- a/mediagoblin/plugins/piwigo/forms.py +++ b/mediagoblin/plugins/piwigo/forms.py @@ -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]) diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py index e2264645..6c0e8e9c 100644 --- a/mediagoblin/submit/forms.py +++ b/mediagoblin/submit/forms.py @@ -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 diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py index eb786f47..1a09864b 100644 --- a/mediagoblin/user_pages/forms.py +++ b/mediagoblin/user_pages/forms.py @@ -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'' u'Markdown 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('')