Ticket #965: 0001-wtforms.fields.TextField-was-deprecated.patch

File 0001-wtforms.fields.TextField-was-deprecated.patch, 12.7 KB (added by gandaro_, 10 years ago)
  • mediagoblin/edit/forms.py

    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  
    2525
    2626
    2727class EditForm(wtforms.Form):
    28     title = wtforms.TextField(
     28    title = wtforms.StringField(
    2929        _('Title'),
    3030        [wtforms.validators.Length(min=0, max=500)])
    3131    description = wtforms.TextAreaField(
    class EditForm(wtforms.Form):  
    3333        description=_("""You can use
    3434                      <a href="http://daringfireball.net/projects/markdown/basics">
    3535                      Markdown</a> for formatting."""))
    36     tags = wtforms.TextField(
     36    tags = wtforms.StringField(
    3737        _('Tags'),
    3838        [tag_length_validator],
    3939        description=_(
    4040            "Separate tags by commas."))
    41     slug = wtforms.TextField(
     41    slug = wtforms.StringField(
    4242        _('Slug'),
    4343        [wtforms.validators.InputRequired(message=_("The slug can't be empty"))],
    4444        description=_(
    class EditProfileForm(wtforms.Form):  
    5656        description=_("""You can use
    5757                      <a href="http://daringfireball.net/projects/markdown/basics">
    5858                      Markdown</a> for formatting."""))
    59     url = wtforms.TextField(
     59    url = wtforms.StringField(
    6060        _('Website'),
    6161        [wtforms.validators.Optional(),
    6262         wtforms.validators.URL(message=_("This address contains errors"))])
    6363
    64     location = wtforms.TextField(_('Hometown'))
     64    location = wtforms.StringField(_('Hometown'))
    6565
    6666class EditAccountForm(wtforms.Form):
    6767    wants_comment_notification = wtforms.BooleanField(
    class EditAccountForm(wtforms.Form):  
    7979
    8080
    8181class EditAttachmentsForm(wtforms.Form):
    82     attachment_name = wtforms.TextField(
     82    attachment_name = wtforms.StringField(
    8383        'Title')
    8484    attachment_file = wtforms.FileField(
    8585        'File')
    8686
    8787
    8888class EditCollectionForm(wtforms.Form):
    89     title = wtforms.TextField(
     89    title = wtforms.StringField(
    9090        _('Title'),
    9191        [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired(message=_("The title can't be empty"))])
    9292    description = wtforms.TextAreaField(
    class EditCollectionForm(wtforms.Form):  
    9494        description=_("""You can use
    9595                      <a href="http://daringfireball.net/projects/markdown/basics">
    9696                      Markdown</a> for formatting."""))
    97     slug = wtforms.TextField(
     97    slug = wtforms.StringField(
    9898        _('Slug'),
    9999        [wtforms.validators.InputRequired(message=_("The slug can't be empty"))],
    100100        description=_(
    class ChangePassForm(wtforms.Form):  
    116116
    117117
    118118class ChangeEmailForm(wtforms.Form):
    119     new_email = wtforms.TextField(
     119    new_email = wtforms.StringField(
    120120        _('New email address'),
    121121        [wtforms.validators.InputRequired(),
    122122         normalize_user_or_email_field(allow_user=False)])
    class MetaDataValidator(object):  
    153153                errors.pop())
    154154
    155155class 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'))
    158158
    159159class EditMetaDataForm(wtforms.Form):
    160160    media_metadata = wtforms.FieldList(
  • mediagoblin/media_types/blog/forms.py

    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 _  
    2121from mediagoblin.tools.licenses import licenses_as_choices
    2222
    2323class BlogPostEditForm(wtforms.Form):
    24     title = wtforms.TextField(_('Title'),
     24    title = wtforms.StringField(_('Title'),
    2525                [wtforms.validators.Length(min=0, max=500)])
    2626    description = wtforms.TextAreaField(_('Description'))
    27     tags = wtforms.TextField(_('Tags'), [tag_length_validator],
     27    tags = wtforms.StringField(_('Tags'), [tag_length_validator],
    2828                description="Seperate tags by commas.")
    2929    license = wtforms.SelectField(_('License'),
    3030                [wtforms.validators.Optional(),], choices=licenses_as_choices())
    3131
    3232class BlogEditForm(wtforms.Form):
    33     title = wtforms.TextField(_('Title'),
     33    title = wtforms.StringField(_('Title'),
    3434                [wtforms.validators.Length(min=0, max=500)])
    3535    description = wtforms.TextAreaField(_('Description'))
    3636   
  • mediagoblin/plugins/basic_auth/forms.py

    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  
    2020
    2121
    2222class RegistrationForm(wtforms.Form):
    23     username = wtforms.TextField(
     23    username = wtforms.StringField(
    2424        _('Username'),
    2525        [wtforms.validators.InputRequired(),
    2626         normalize_user_or_email_field(allow_email=False)])
    class RegistrationForm(wtforms.Form):  
    2828        _('Password'),
    2929        [wtforms.validators.InputRequired(),
    3030         wtforms.validators.Length(min=5, max=1024)])
    31     email = wtforms.TextField(
     31    email = wtforms.StringField(
    3232        _('Email address'),
    3333        [wtforms.validators.InputRequired(),
    3434         normalize_user_or_email_field(allow_user=False)])
    3535
    3636
    3737class LoginForm(wtforms.Form):
    38     username = wtforms.TextField(
     38    username = wtforms.StringField(
    3939        _('Username or Email'),
    4040        [wtforms.validators.InputRequired(),
    4141         normalize_user_or_email_field()])
    class LoginForm(wtforms.Form):  
    4747
    4848
    4949class ForgotPassForm(wtforms.Form):
    50     username = wtforms.TextField(
     50    username = wtforms.StringField(
    5151        _('Username or email'),
    5252        [wtforms.validators.InputRequired(),
    5353         normalize_user_or_email_field()])
  • mediagoblin/plugins/ldap/forms.py

    diff --git a/mediagoblin/plugins/ldap/forms.py b/mediagoblin/plugins/ldap/forms.py
    index 1f1439a..3d966e0 100644
    a b class RegisterForm(wtforms.Form):  
    2424        '',
    2525        [wtforms.validators.InputRequired(),
    2626         normalize_user_or_email_field(allow_email=False)])
    27     email = wtforms.TextField(
     27    email = wtforms.StringField(
    2828        _('Email address'),
    2929        [wtforms.validators.InputRequired(),
    3030         normalize_user_or_email_field(allow_user=False)])
    3131
    3232
    3333class LoginForm(wtforms.Form):
    34     username = wtforms.TextField(
     34    username = wtforms.StringField(
    3535        _('Username'),
    3636        [wtforms.validators.InputRequired(),
    3737         normalize_user_or_email_field()])
  • mediagoblin/plugins/openid/forms.py

    diff --git a/mediagoblin/plugins/openid/forms.py b/mediagoblin/plugins/openid/forms.py
    index d47369d..6dfde0c 100644
    a b class RegistrationForm(wtforms.Form):  
    2323    openid = wtforms.HiddenField(
    2424        '',
    2525        [wtforms.validators.InputRequired()])
    26     username = wtforms.TextField(
     26    username = wtforms.StringField(
    2727        _('Username'),
    2828        [wtforms.validators.InputRequired(),
    2929         normalize_user_or_email_field(allow_email=False)])
    30     email = wtforms.TextField(
     30    email = wtforms.StringField(
    3131        _('Email address'),
    3232        [wtforms.validators.InputRequired(),
    3333         normalize_user_or_email_field(allow_user=False)])
    3434
    3535
    3636class LoginForm(wtforms.Form):
    37     openid = wtforms.TextField(
     37    openid = wtforms.StringField(
    3838        _('OpenID'),
    3939        [wtforms.validators.InputRequired(),
    4040         # Can openid's only be urls?
  • mediagoblin/plugins/persona/forms.py

    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  
    2020
    2121
    2222class RegistrationForm(wtforms.Form):
    23     username = wtforms.TextField(
     23    username = wtforms.StringField(
    2424        _('Username'),
    2525        [wtforms.validators.InputRequired(),
    2626         normalize_user_or_email_field(allow_email=False)])
    27     email = wtforms.TextField(
     27    email = wtforms.StringField(
    2828        _('Email address'),
    2929        [wtforms.validators.InputRequired(),
    3030         normalize_user_or_email_field(allow_user=False)])
    class RegistrationForm(wtforms.Form):  
    3535
    3636
    3737class EditForm(wtforms.Form):
    38     email = wtforms.TextField(
     38    email = wtforms.StringField(
    3939        _('Email address'),
    4040        [wtforms.validators.InputRequired(),
    4141         normalize_user_or_email_field(allow_user=False)])
  • mediagoblin/plugins/piwigo/forms.py

    diff --git a/mediagoblin/plugins/piwigo/forms.py b/mediagoblin/plugins/piwigo/forms.py
    index fd545a3..b501562 100644
    a b import wtforms  
    2020
    2121class AddSimpleForm(wtforms.Form):
    2222    image = wtforms.FileField()
    23     name = wtforms.TextField(
     23    name = wtforms.StringField(
    2424        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())
    2727    category = wtforms.IntegerField()
    2828    level = wtforms.IntegerField()
    2929
    _md5_validator = wtforms.validators.Regexp(r"^[0-9a-fA-F]{32}$")  
    3232
    3333
    3434class AddForm(wtforms.Form):
    35     original_sum = wtforms.TextField(None,
     35    original_sum = wtforms.StringField(None,
    3636        [_md5_validator,
    3737         wtforms.validators.InputRequired()])
    38     thumbnail_sum = wtforms.TextField(None,
     38    thumbnail_sum = wtforms.StringField(None,
    3939        [wtforms.validators.Optional(),
    4040         _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()
  • mediagoblin/submit/forms.py

    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):  
    3333        file = wtforms.FileField(
    3434            _('File'),
    3535            description=desc)
    36         title = wtforms.TextField(
     36        title = wtforms.StringField(
    3737            _('Title'),
    3838            [wtforms.validators.Length(min=0, max=500)])
    3939        description = wtforms.TextAreaField(
    def get_submit_start_form(form, **kwargs):  
    4141            description=_("""You can use
    4242                        <a href="http://daringfireball.net/projects/markdown/basics">
    4343                        Markdown</a> for formatting."""))
    44         tags = wtforms.TextField(
     44        tags = wtforms.StringField(
    4545            _('Tags'),
    4646            [tag_length_validator],
    4747            description=_(
    def get_submit_start_form(form, **kwargs):  
    5757    return SubmitStartForm(form, **kwargs)
    5858
    5959class AddCollectionForm(wtforms.Form):
    60     title = wtforms.TextField(
     60    title = wtforms.StringField(
    6161        _('Title'),
    6262        [wtforms.validators.Length(min=0, max=500), wtforms.validators.InputRequired()])
    6363    description = wtforms.TextAreaField(
  • mediagoblin/user_pages/forms.py

    diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py
    index 1a09864..77e280e 100644
    a b class MediaCollectForm(wtforms.Form):  
    4141    note = wtforms.TextAreaField(
    4242        _('Include a note'),
    4343        [wtforms.validators.Optional()],)
    44     collection_title = wtforms.TextField(
     44    collection_title = wtforms.StringField(
    4545        _('Title'),
    4646        [wtforms.validators.Length(min=0, max=500)])
    4747    collection_description = wtforms.TextAreaField(