Skip to content

Commit 6c57309

Browse files
committed
deprecate html5 in favor of using wtforms directly
closes #236
1 parent 42cc475 commit 6c57309

File tree

5 files changed

+14
-106
lines changed

5 files changed

+14
-106
lines changed

docs/api.rst

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,6 @@ Forms and Fields
2828

2929
.. autoclass:: FileRequired
3030

31-
.. module:: flask_wtf.html5
32-
33-
.. autoclass:: SearchInput
34-
35-
.. autoclass:: SearchField
36-
37-
.. autoclass:: URLInput
38-
39-
.. autoclass:: URLField
40-
41-
.. autoclass:: EmailInput
42-
43-
.. autoclass:: EmailField
44-
45-
.. autoclass:: TelInput
46-
47-
.. autoclass:: TelField
48-
49-
.. autoclass:: NumberInput
50-
51-
.. autoclass:: IntegerField
52-
53-
.. autoclass:: DecimalField
54-
55-
.. autoclass:: RangeInput
56-
57-
.. autoclass:: IntegerRangeField
58-
59-
.. autoclass:: DecimalRangeField
60-
61-
6231
CSRF Protection
6332
---------------
6433

docs/form.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,6 @@ to :class:`FileAllowed`::
9292
FileAllowed(['jpg', 'png'], 'Images only!')
9393
])
9494

95-
HTML5 Widgets
96-
-------------
97-
98-
.. note::
99-
100-
HTML5 widgets and fields are builtin of wtforms since 1.0.5. You
101-
should consider import them from wtforms if possible.
102-
103-
We will drop html5 module in next release 0.9.3.
104-
105-
You can import a number of HTML5 widgets from ``wtforms``::
106-
107-
from wtforms.fields.html5 import URLField
108-
from wtforms.validators import url
109-
110-
class LinkForm(Form):
111-
url = URLField(validators=[url()])
112-
11395

11496
.. _recaptcha:
11597

flask_wtf/html5.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# coding: utf-8
22
# flake8: noqa
3+
import warnings
4+
from flask_wtf._compat import FlaskWTFDeprecationWarning
5+
6+
warnings.warn(FlaskWTFDeprecationWarning(
7+
'"flask_wtf.html5" will be removed in 1.0. '
8+
'Import directly from "wtforms.fields.html5" '
9+
'and "wtforms.widgets.html5".'
10+
), stacklevel=2)
11+
312
from wtforms.widgets.html5 import *
413
from wtforms.fields.html5 import *

tests/test_form.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
class TestForm(TestCase):
88
def test_deprecated_form(self):
9-
def define_deprecated_form():
10-
class F(Form):
11-
pass
9+
with warnings.catch_warnings():
10+
warnings.simplefilter('error', FlaskWTFDeprecationWarning)
11+
self.assertRaises(FlaskWTFDeprecationWarning, type, 'F', (Form,), {})
1212

13+
def test_deprecated_html5(self):
1314
with warnings.catch_warnings():
1415
warnings.simplefilter('error', FlaskWTFDeprecationWarning)
15-
self.assertRaises(FlaskWTFDeprecationWarning, define_deprecated_form)
16+
self.assertRaises(FlaskWTFDeprecationWarning, __import__, 'flask_wtf.html5')

tests/test_html5.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)