diff --git a/CHANGES.rst b/CHANGES.rst index 5f12719bc..15f8460f1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,8 +15,12 @@ Unreleased - :class:`~wtforms.validators.NoneOf` and :class:`~wtforms.validators.AnyOf` can validate multiple valued fields like :class:`~fields.SelectMultipleField` :pr:`538` :pr:`807` +- ⚠️Breaking change⚠️: Some deprecated code was removed (:pr:`859`): -- Breaking change: The key for form errors moved from :data:`None` to + - :class:`~wtforms.Flags` can no longer be tuples. :issue:`467` + - `iter_choices` needs a tuple of 4 items :issue:`816` + +- ⚠️Breaking change⚠️: The key for form errors moved from :data:`None` to empty string `""`. :issue:`829` :pr:`858` .. note:: diff --git a/src/wtforms/fields/core.py b/src/wtforms/fields/core.py index 777365b36..2155a89ea 100644 --- a/src/wtforms/fields/core.py +++ b/src/wtforms/fields/core.py @@ -1,6 +1,5 @@ import inspect import itertools -import warnings from markupsafe import escape from markupsafe import Markup @@ -131,17 +130,6 @@ def __init__( for v in itertools.chain(self.validators, [self.widget]): flags = getattr(v, "field_flags", {}) - # check for legacy format, remove eventually - if isinstance(flags, tuple): # pragma: no cover - warnings.warn( - "Flags should be stored in dicts and not in tuples. " - "The next version of WTForms will abandon support " - "for flags in tuples.", - DeprecationWarning, - stacklevel=2, - ) - flags = {flag_name: True for flag_name in flags} - for k, v in flags.items(): setattr(self.flags, k, v) diff --git a/src/wtforms/widgets/core.py b/src/wtforms/widgets/core.py index 0acf9d1e1..832918e82 100644 --- a/src/wtforms/widgets/core.py +++ b/src/wtforms/widgets/core.py @@ -1,5 +1,3 @@ -import warnings - from markupsafe import escape from markupsafe import Markup @@ -368,32 +366,12 @@ def __call__(self, field, **kwargs): optgroup_params = html_params(label=group) html.append(f"") for choice in choices: - if len(choice) == 4: - val, label, selected, render_kw = choice - else: - warnings.warn( - "'iter_groups' is expected to return 4 items tuple since " - "wtforms 3.1, this will be mandatory in wtforms 3.2", - DeprecationWarning, - stacklevel=2, - ) - val, label, selected = choice - render_kw = {} + val, label, selected, render_kw = choice html.append(self.render_option(val, label, selected, **render_kw)) html.append("") else: for choice in field.iter_choices(): - if len(choice) == 4: - val, label, selected, render_kw = choice - else: - warnings.warn( - "'iter_choices' is expected to return 4 items tuple since " - "wtforms 3.1, this will be mandatory in wtforms 3.2", - DeprecationWarning, - stacklevel=2, - ) - val, label, selected = choice - render_kw = {} + val, label, selected, render_kw = choice html.append(self.render_option(val, label, selected, **render_kw)) html.append("") return Markup("".join(html))