Skip to content

Commit

Permalink
deprecate html5 in favor of using wtforms directly
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed Jul 1, 2016
1 parent 42cc475 commit e5cd31d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 106 deletions.
31 changes: 0 additions & 31 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,6 @@ Forms and Fields

.. autoclass:: FileRequired

.. module:: flask_wtf.html5

.. autoclass:: SearchInput

.. autoclass:: SearchField

.. autoclass:: URLInput

.. autoclass:: URLField

.. autoclass:: EmailInput

.. autoclass:: EmailField

.. autoclass:: TelInput

.. autoclass:: TelField

.. autoclass:: NumberInput

.. autoclass:: IntegerField

.. autoclass:: DecimalField

.. autoclass:: RangeInput

.. autoclass:: IntegerRangeField

.. autoclass:: DecimalRangeField


CSRF Protection
---------------

Expand Down
18 changes: 0 additions & 18 deletions docs/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,6 @@ to :class:`FileAllowed`::
FileAllowed(['jpg', 'png'], 'Images only!')
])

HTML5 Widgets
-------------

.. note::

HTML5 widgets and fields are builtin of wtforms since 1.0.5. You
should consider import them from wtforms if possible.

We will drop html5 module in next release 0.9.3.

You can import a number of HTML5 widgets from ``wtforms``::

from wtforms.fields.html5 import URLField
from wtforms.validators import url

class LinkForm(Form):
url = URLField(validators=[url()])


.. _recaptcha:

Expand Down
9 changes: 9 additions & 0 deletions flask_wtf/html5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# coding: utf-8
# flake8: noqa
import warnings
from flask_wtf._compat import FlaskWTFDeprecationWarning

warnings.warn(FlaskWTFDeprecationWarning(
'"flask_wtf.html5" will be removed in 1.0. '
'Import directly from "wtforms.fields.html5" '
'and "wtforms.widgets.html5".'
), stacklevel=2)

from wtforms.widgets.html5 import *
from wtforms.fields.html5 import *
10 changes: 6 additions & 4 deletions tests/test_form.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import warnings
from importlib import import_module
from unittest import TestCase
from flask_wtf import Form
from flask_wtf._compat import FlaskWTFDeprecationWarning


class TestForm(TestCase):
def test_deprecated_form(self):
def define_deprecated_form():
class F(Form):
pass
with warnings.catch_warnings():
warnings.simplefilter('error', FlaskWTFDeprecationWarning)
self.assertRaises(FlaskWTFDeprecationWarning, type, 'F', (Form,), {})

def test_deprecated_html5(self):
with warnings.catch_warnings():
warnings.simplefilter('error', FlaskWTFDeprecationWarning)
self.assertRaises(FlaskWTFDeprecationWarning, define_deprecated_form)
self.assertRaises(FlaskWTFDeprecationWarning, import_module, 'flask_wtf.html5')
53 changes: 0 additions & 53 deletions tests/test_html5.py

This file was deleted.

0 comments on commit e5cd31d

Please sign in to comment.