summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-12-21 00:15:39 +0100
committerClaude Paroz <claude@2xlibre.net>2013-12-28 21:25:32 +0100
commit6d66ba59488bbd0d4f0c2f32b2921f1512301143 (patch)
tree5456bc8cee41877c0340cf4da1151e2ee5bf7695 /docs
parent9f13c3328199d2fa70235cdc63bb06b1efc5b117 (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')
-rw-r--r--docs/ref/validators.txt18
-rw-r--r--docs/releases/1.7.txt7
2 files changed, 23 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``
------------------
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 0d83c3aa81..a7e7da6d15 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -567,6 +567,13 @@ Tests
* :meth:`~django.test.TransactionTestCase.assertNumQueries` now prints
out the list of executed queries if the assertion fails.
+Validators
+^^^^^^^^^^
+
+* :class:`~django.core.validators.URLValidator` now accepts an optional
+ ``schemes`` argument which allows customization of the accepted URI schemes
+ (instead of the defaults ``http(s)`` and ``ftp(s)``).
+
Backwards incompatible changes in 1.7
=====================================