diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-12-21 00:15:39 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-12-28 21:25:32 +0100 |
| commit | 6d66ba59488bbd0d4f0c2f32b2921f1512301143 (patch) | |
| tree | 5456bc8cee41877c0340cf4da1151e2ee5bf7695 /docs/ref/validators.txt | |
| parent | 9f13c3328199d2fa70235cdc63bb06b1efc5b117 (diff) | |
Fixed #21242 -- Allowed more IANA schemes in URLValidator
Thanks Sascha Peilicke for the report and initial patch, and
Tim Graham for the review.
Diffstat (limited to 'docs/ref/validators.txt')
| -rw-r--r-- | docs/ref/validators.txt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index 92e257ca85..1b706ab8e3 100644 --- a/docs/ref/validators.txt +++ b/docs/ref/validators.txt @@ -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`` ------------------ |
