Refs #31670 -- Renamed whitelist argument and attribute of EmailValidator.

This commit is contained in:
David Smith 2020-06-17 07:35:09 +01:00 committed by Mariusz Felisiak
parent 26a413507a
commit 27c09043da
6 changed files with 104 additions and 18 deletions

View file

@ -119,11 +119,11 @@ to, or in lieu of custom ``field.clean()`` methods.
``EmailValidator``
------------------
.. class:: EmailValidator(message=None, code=None, whitelist=None)
.. class:: EmailValidator(message=None, code=None, allowlist=None)
:param message: If not ``None``, overrides :attr:`.message`.
:param code: If not ``None``, overrides :attr:`code`.
:param whitelist: If not ``None``, overrides :attr:`whitelist`.
:param allowlist: If not ``None``, overrides :attr:`allowlist`.
.. attribute:: message
@ -136,14 +136,22 @@ to, or in lieu of custom ``field.clean()`` methods.
The error code used by :exc:`~django.core.exceptions.ValidationError`
if validation fails. Defaults to ``"invalid"``.
.. attribute:: whitelist
.. attribute:: allowlist
Whitelist of email domains to allow. By default, a regular expression
(the ``domain_regex`` attribute) is used to validate whatever appears
after the @ sign. However, if that string appears in the whitelist, this
validation is bypassed. If not provided, the default whitelist is
``['localhost']``. Other domains that don't contain a dot won't pass
validation, so you'd need to whitelist them as necessary.
Allowlist of email domains. By default, a regular expression (the
``domain_regex`` attribute) is used to validate whatever appears after
the ``@`` sign. However, if that string appears in the ``allowlist``,
this validation is bypassed. If not provided, the default ``allowlist``
is ``['localhost']``. Other domains that don't contain a dot won't pass
validation, so you'd need to add them to the ``allowlist`` as
necessary.
.. deprecated:: 3.2
The ``whitelist`` parameter is deprecated. Use :attr:`allowlist`
instead.
The undocumented ``domain_whitelist`` attribute is deprecated. Use
``domain_allowlist`` instead.
``URLValidator``
----------------