From 52ca1a8947f6021d8362c38256d7b7b0c71ab8bb Mon Sep 17 00:00:00 2001
From: Jakob Kramer <jakob.kramer@gmx.de>
Date: Sat, 7 Mar 2015 21:48:13 +0100
Subject: [PATCH] wtforms.fields.TextField was deprecated
WTForms documentation:
> The TextField alias for StringField is deprecated.
---
mediagoblin/edit/forms.py | 22 +++++++++++-----------
mediagoblin/media_types/blog/forms.py | 6 +++---
mediagoblin/plugins/basic_auth/forms.py | 8 ++++----
mediagoblin/plugins/ldap/forms.py | 4 ++--
mediagoblin/plugins/openid/forms.py | 6 +++---
mediagoblin/plugins/persona/forms.py | 6 +++---
mediagoblin/plugins/piwigo/forms.py | 18 +++++++++---------
mediagoblin/submit/forms.py | 6 +++---
mediagoblin/user_pages/forms.py | 2 +-
9 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py
index f0a03e0..cf5056c 100644
|
a
|
b
|
from mediagoblin.auth.tools import normalize_user_or_email_field
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | class EditForm(wtforms.Form): |
| 28 | | title = wtforms.TextField( |
| | 28 | title = wtforms.StringField( |
| 29 | 29 | _('Title'), |
| 30 | 30 | [wtforms.validators.Length(min=0, max=500)]) |
| 31 | 31 | description = wtforms.TextAreaField( |
| … |
… |
class EditForm(wtforms.Form):
|
| 33 | 33 | description=_("""You can use |
| 34 | 34 | <a href="http://daringfireball.net/projects/markdown/basics"> |
| 35 | 35 | Markdown</a> for formatting.""")) |
| 36 | | tags = wtforms.TextField( |
| | 36 | tags = wtforms.StringField( |
| 37 | 37 | _('Tags'), |
| 38 | 38 | [tag_length_validator], |
| 39 | 39 | description=_( |
| 40 | 40 | "Separate tags by commas.")) |
| 41 | | slug = wtforms.TextField( |
| | 41 | slug = wtforms.StringField( |
| 42 | 42 | _('Slug'), |
| 43 | 43 | [wtforms.validators.InputRequired(message=_("The slug can't be empty"))], |
| 44 | 44 | description=_( |
| … |
… |
class EditProfileForm(wtforms.Form):
|
| 56 | 56 | description=_("""You can use |
| 57 | 57 | <a href="http://daringfireball.net/projects/markdown/basics"> |
| 58 | 58 | Markdown</a> for formatting.""")) |
| 59 | | url = wtforms.TextField( |
| | 59 | url = wtforms.StringField( |
| 60 | 60 | _('Website'), |
| 61 | 61 | [wtforms.validators.Optional(), |
| 62 | 62 | wtforms.validators.URL(message=_("This address contains errors"))]) |
| 63 | 63 | |
| 64 | | location = wtforms.TextField(_('Hometown')) |
| | 64 | location = wtforms.StringField(_('Hometown')) |
| 65 | 65 | |
| 66 | 66 | class EditAccountForm(wtforms.Form): |
| 67 | 67 | wants_comment_notification = wtforms.BooleanField( |
| … |
… |
class EditAccountForm(wtforms.Form):
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | class EditAttachmentsForm(wtforms.Form): |
| 82 | | attachment_name = wtforms.TextField( |
| | 82 | attachment_name = wtforms.StringField( |
| 83 | 83 | 'Title') |
| 84 | 84 | attachment_file = wtforms.FileField( |
| 85 | 85 | 'File') |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | class EditCollectionForm(wtforms.Form): |
| 89 | | title = wtforms.TextField( |
| | 89 | title = wtforms.StringField( |
| 90 | 90 | _('Title'), |
| 91 | 91 | [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired(message=_("The title can't be empty"))]) |
| 92 | 92 | description = wtforms.TextAreaField( |
| … |
… |
class EditCollectionForm(wtforms.Form):
|
| 94 | 94 | description=_("""You can use |
| 95 | 95 | <a href="http://daringfireball.net/projects/markdown/basics"> |
| 96 | 96 | Markdown</a> for formatting.""")) |
| 97 | | slug = wtforms.TextField( |
| | 97 | slug = wtforms.StringField( |
| 98 | 98 | _('Slug'), |
| 99 | 99 | [wtforms.validators.InputRequired(message=_("The slug can't be empty"))], |
| 100 | 100 | description=_( |
| … |
… |
class ChangePassForm(wtforms.Form):
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | class ChangeEmailForm(wtforms.Form): |
| 119 | | new_email = wtforms.TextField( |
| | 119 | new_email = wtforms.StringField( |
| 120 | 120 | _('New email address'), |
| 121 | 121 | [wtforms.validators.InputRequired(), |
| 122 | 122 | normalize_user_or_email_field(allow_user=False)]) |
| … |
… |
class MetaDataValidator(object):
|
| 153 | 153 | errors.pop()) |
| 154 | 154 | |
| 155 | 155 | class MetaDataForm(wtforms.Form): |
| 156 | | identifier = wtforms.TextField(_(u'Identifier'),[MetaDataValidator()]) |
| 157 | | value = wtforms.TextField(_(u'Value')) |
| | 156 | identifier = wtforms.StringField(_(u'Identifier'),[MetaDataValidator()]) |
| | 157 | value = wtforms.StringField(_(u'Value')) |
| 158 | 158 | |
| 159 | 159 | class EditMetaDataForm(wtforms.Form): |
| 160 | 160 | media_metadata = wtforms.FieldList( |
diff --git a/mediagoblin/media_types/blog/forms.py b/mediagoblin/media_types/blog/forms.py
index 1cc41a0..c70cd35 100644
|
a
|
b
|
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
| 21 | 21 | from mediagoblin.tools.licenses import licenses_as_choices |
| 22 | 22 | |
| 23 | 23 | class BlogPostEditForm(wtforms.Form): |
| 24 | | title = wtforms.TextField(_('Title'), |
| | 24 | title = wtforms.StringField(_('Title'), |
| 25 | 25 | [wtforms.validators.Length(min=0, max=500)]) |
| 26 | 26 | description = wtforms.TextAreaField(_('Description')) |
| 27 | | tags = wtforms.TextField(_('Tags'), [tag_length_validator], |
| | 27 | tags = wtforms.StringField(_('Tags'), [tag_length_validator], |
| 28 | 28 | description="Seperate tags by commas.") |
| 29 | 29 | license = wtforms.SelectField(_('License'), |
| 30 | 30 | [wtforms.validators.Optional(),], choices=licenses_as_choices()) |
| 31 | 31 | |
| 32 | 32 | class BlogEditForm(wtforms.Form): |
| 33 | | title = wtforms.TextField(_('Title'), |
| | 33 | title = wtforms.StringField(_('Title'), |
| 34 | 34 | [wtforms.validators.Length(min=0, max=500)]) |
| 35 | 35 | description = wtforms.TextAreaField(_('Description')) |
| 36 | 36 | |
diff --git a/mediagoblin/plugins/basic_auth/forms.py b/mediagoblin/plugins/basic_auth/forms.py
index 42b84bf..9a6db22 100644
|
a
|
b
|
from mediagoblin.auth.tools import normalize_user_or_email_field
|
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | class RegistrationForm(wtforms.Form): |
| 23 | | username = wtforms.TextField( |
| | 23 | username = wtforms.StringField( |
| 24 | 24 | _('Username'), |
| 25 | 25 | [wtforms.validators.InputRequired(), |
| 26 | 26 | normalize_user_or_email_field(allow_email=False)]) |
| … |
… |
class RegistrationForm(wtforms.Form):
|
| 28 | 28 | _('Password'), |
| 29 | 29 | [wtforms.validators.InputRequired(), |
| 30 | 30 | wtforms.validators.Length(min=5, max=1024)]) |
| 31 | | email = wtforms.TextField( |
| | 31 | email = wtforms.StringField( |
| 32 | 32 | _('Email address'), |
| 33 | 33 | [wtforms.validators.InputRequired(), |
| 34 | 34 | normalize_user_or_email_field(allow_user=False)]) |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | class LoginForm(wtforms.Form): |
| 38 | | username = wtforms.TextField( |
| | 38 | username = wtforms.StringField( |
| 39 | 39 | _('Username or Email'), |
| 40 | 40 | [wtforms.validators.InputRequired(), |
| 41 | 41 | normalize_user_or_email_field()]) |
| … |
… |
class LoginForm(wtforms.Form):
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | class ForgotPassForm(wtforms.Form): |
| 50 | | username = wtforms.TextField( |
| | 50 | username = wtforms.StringField( |
| 51 | 51 | _('Username or email'), |
| 52 | 52 | [wtforms.validators.InputRequired(), |
| 53 | 53 | normalize_user_or_email_field()]) |
diff --git a/mediagoblin/plugins/ldap/forms.py b/mediagoblin/plugins/ldap/forms.py
index 1f1439a..3d966e0 100644
|
a
|
b
|
class RegisterForm(wtforms.Form):
|
| 24 | 24 | '', |
| 25 | 25 | [wtforms.validators.InputRequired(), |
| 26 | 26 | normalize_user_or_email_field(allow_email=False)]) |
| 27 | | email = wtforms.TextField( |
| | 27 | email = wtforms.StringField( |
| 28 | 28 | _('Email address'), |
| 29 | 29 | [wtforms.validators.InputRequired(), |
| 30 | 30 | normalize_user_or_email_field(allow_user=False)]) |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | class LoginForm(wtforms.Form): |
| 34 | | username = wtforms.TextField( |
| | 34 | username = wtforms.StringField( |
| 35 | 35 | _('Username'), |
| 36 | 36 | [wtforms.validators.InputRequired(), |
| 37 | 37 | normalize_user_or_email_field()]) |
diff --git a/mediagoblin/plugins/openid/forms.py b/mediagoblin/plugins/openid/forms.py
index d47369d..6dfde0c 100644
|
a
|
b
|
class RegistrationForm(wtforms.Form):
|
| 23 | 23 | openid = wtforms.HiddenField( |
| 24 | 24 | '', |
| 25 | 25 | [wtforms.validators.InputRequired()]) |
| 26 | | username = wtforms.TextField( |
| | 26 | username = wtforms.StringField( |
| 27 | 27 | _('Username'), |
| 28 | 28 | [wtforms.validators.InputRequired(), |
| 29 | 29 | normalize_user_or_email_field(allow_email=False)]) |
| 30 | | email = wtforms.TextField( |
| | 30 | email = wtforms.StringField( |
| 31 | 31 | _('Email address'), |
| 32 | 32 | [wtforms.validators.InputRequired(), |
| 33 | 33 | normalize_user_or_email_field(allow_user=False)]) |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | class LoginForm(wtforms.Form): |
| 37 | | openid = wtforms.TextField( |
| | 37 | openid = wtforms.StringField( |
| 38 | 38 | _('OpenID'), |
| 39 | 39 | [wtforms.validators.InputRequired(), |
| 40 | 40 | # Can openid's only be urls? |
diff --git a/mediagoblin/plugins/persona/forms.py b/mediagoblin/plugins/persona/forms.py
index 7d63234..f74d97f 100644
|
a
|
b
|
from mediagoblin.auth.tools import normalize_user_or_email_field
|
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | class RegistrationForm(wtforms.Form): |
| 23 | | username = wtforms.TextField( |
| | 23 | username = wtforms.StringField( |
| 24 | 24 | _('Username'), |
| 25 | 25 | [wtforms.validators.InputRequired(), |
| 26 | 26 | normalize_user_or_email_field(allow_email=False)]) |
| 27 | | email = wtforms.TextField( |
| | 27 | email = wtforms.StringField( |
| 28 | 28 | _('Email address'), |
| 29 | 29 | [wtforms.validators.InputRequired(), |
| 30 | 30 | normalize_user_or_email_field(allow_user=False)]) |
| … |
… |
class RegistrationForm(wtforms.Form):
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | class EditForm(wtforms.Form): |
| 38 | | email = wtforms.TextField( |
| | 38 | email = wtforms.StringField( |
| 39 | 39 | _('Email address'), |
| 40 | 40 | [wtforms.validators.InputRequired(), |
| 41 | 41 | normalize_user_or_email_field(allow_user=False)]) |
diff --git a/mediagoblin/plugins/piwigo/forms.py b/mediagoblin/plugins/piwigo/forms.py
index fd545a3..b501562 100644
|
a
|
b
|
import wtforms
|
| 20 | 20 | |
| 21 | 21 | class AddSimpleForm(wtforms.Form): |
| 22 | 22 | image = wtforms.FileField() |
| 23 | | name = wtforms.TextField( |
| | 23 | name = wtforms.StringField( |
| 24 | 24 | validators=[wtforms.validators.Length(min=0, max=500)]) |
| 25 | | comment = wtforms.TextField() |
| 26 | | # tags = wtforms.FieldList(wtforms.TextField()) |
| | 25 | comment = wtforms.StringField() |
| | 26 | # tags = wtforms.FieldList(wtforms.StringField()) |
| 27 | 27 | category = wtforms.IntegerField() |
| 28 | 28 | level = wtforms.IntegerField() |
| 29 | 29 | |
| … |
… |
_md5_validator = wtforms.validators.Regexp(r"^[0-9a-fA-F]{32}$")
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | class AddForm(wtforms.Form): |
| 35 | | original_sum = wtforms.TextField(None, |
| | 35 | original_sum = wtforms.StringField(None, |
| 36 | 36 | [_md5_validator, |
| 37 | 37 | wtforms.validators.InputRequired()]) |
| 38 | | thumbnail_sum = wtforms.TextField(None, |
| | 38 | thumbnail_sum = wtforms.StringField(None, |
| 39 | 39 | [wtforms.validators.Optional(), |
| 40 | 40 | _md5_validator]) |
| 41 | | file_sum = wtforms.TextField(None, [_md5_validator]) |
| 42 | | name = wtforms.TextField() |
| 43 | | date_creation = wtforms.TextField() |
| 44 | | categories = wtforms.TextField() |
| | 41 | file_sum = wtforms.StringField(None, [_md5_validator]) |
| | 42 | name = wtforms.StringField() |
| | 43 | date_creation = wtforms.StringField() |
| | 44 | categories = wtforms.StringField() |
diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py
index 6c0e8e9..c5bacc4 100644
|
a
|
b
|
def get_submit_start_form(form, **kwargs):
|
| 33 | 33 | file = wtforms.FileField( |
| 34 | 34 | _('File'), |
| 35 | 35 | description=desc) |
| 36 | | title = wtforms.TextField( |
| | 36 | title = wtforms.StringField( |
| 37 | 37 | _('Title'), |
| 38 | 38 | [wtforms.validators.Length(min=0, max=500)]) |
| 39 | 39 | description = wtforms.TextAreaField( |
| … |
… |
def get_submit_start_form(form, **kwargs):
|
| 41 | 41 | description=_("""You can use |
| 42 | 42 | <a href="http://daringfireball.net/projects/markdown/basics"> |
| 43 | 43 | Markdown</a> for formatting.""")) |
| 44 | | tags = wtforms.TextField( |
| | 44 | tags = wtforms.StringField( |
| 45 | 45 | _('Tags'), |
| 46 | 46 | [tag_length_validator], |
| 47 | 47 | description=_( |
| … |
… |
def get_submit_start_form(form, **kwargs):
|
| 57 | 57 | return SubmitStartForm(form, **kwargs) |
| 58 | 58 | |
| 59 | 59 | class AddCollectionForm(wtforms.Form): |
| 60 | | title = wtforms.TextField( |
| | 60 | title = wtforms.StringField( |
| 61 | 61 | _('Title'), |
| 62 | 62 | [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired()]) |
| 63 | 63 | description = wtforms.TextAreaField( |
diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py
index 1a09864..77e280e 100644
|
a
|
b
|
class MediaCollectForm(wtforms.Form):
|
| 41 | 41 | note = wtforms.TextAreaField( |
| 42 | 42 | _('Include a note'), |
| 43 | 43 | [wtforms.validators.Optional()],) |
| 44 | | collection_title = wtforms.TextField( |
| | 44 | collection_title = wtforms.StringField( |
| 45 | 45 | _('Title'), |
| 46 | 46 | [wtforms.validators.Length(min=0, max=500)]) |
| 47 | 47 | collection_description = wtforms.TextAreaField( |