Fixed #21242 -- Allowed more IANA schemes in URLValidator

Thanks Sascha Peilicke for the report and initial patch, and
Tim Graham for the review.
This commit is contained in:
Claude Paroz 2013-12-21 00:15:39 +01:00
parent 9f13c33281
commit 6d66ba5948
4 changed files with 44 additions and 4 deletions

View file

@ -87,10 +87,24 @@ to, or in lieu of custom ``field.clean()`` methods.
``URLValidator``
----------------
.. class:: URLValidator()
.. class:: URLValidator([schemes=None, regex=None, message=None, code=None])
A :class:`RegexValidator` that ensures a value looks like a URL, and raises
an error code of ``'invalid'`` if it doesn't.
an error code of ``'invalid'`` if it doesn't. In addition to the optional
arguments of its parent :class:`RegexValidator` class, ``URLValidator``
accepts an extra optional attribute:
.. attribute:: schemes
URL/URI scheme list to validate against. If not provided, the default
list is ``['http', 'https', 'ftp', 'ftps']``. As a reference, the IANA
Web site provides a full list of `valid URI schemes`_.
.. _valid URI schemes: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
.. versionchanged:: 1.7
The optional ``schemes`` attribute was added.
``validate_email``
------------------