Removed deprecated URLField.verify_exists.

The deprecation schedule was slightly accelerated because of possible security ramifications.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin 2012-03-31 13:55:03 +00:00
parent 800e3941c5
commit 9ed6e08ff9
15 changed files with 32 additions and 251 deletions

View file

@ -789,7 +789,7 @@ For each field, we describe the default widget used if you don't specify
* Empty value: ``''`` (an empty string)
* Normalizes to: A Unicode object.
* Validates that the given value is a valid URL.
* Error message keys: ``required``, ``invalid``, ``invalid_link``
* Error message keys: ``required``, ``invalid``
Takes the following optional arguments:
@ -798,20 +798,6 @@ For each field, we describe the default widget used if you don't specify
These are the same as ``CharField.max_length`` and ``CharField.min_length``.
.. attribute:: verify_exists
If ``True``, the validator will attempt to load the given URL, raising
``ValidationError`` if the page gives a 404. Defaults to ``False``.
.. deprecated:: 1.4
``verify_exists`` was deprecated for security reasons and will be removed in
Django 1.5. This deprecation also removes ``validator_user_agent``.
.. attribute:: validator_user_agent
String used as the user-agent used when checking for a URL's existence.
Defaults to the value of the :setting:`URL_VALIDATOR_USER_AGENT` setting.
.. versionchanged:: 1.2
The URLField previously did not recognize URLs as valid that contained an IDN
(Internationalized Domain Name; a domain name containing unicode characters)

View file

@ -484,10 +484,10 @@ A :class:`CharField` that checks that the value is a valid email address.
.. admonition:: Incompliance to RFCs
The default 75 character ``max_length`` is not capable of storing all
possible RFC3696/5321-compliant email addresses. In order to store all
possible valid email addresses, a ``max_length`` of 254 is required.
The default ``max_length`` of 75 exists for historical reasons. The
default has not been changed in order to maintain backwards
possible RFC3696/5321-compliant email addresses. In order to store all
possible valid email addresses, a ``max_length`` of 254 is required.
The default ``max_length`` of 75 exists for historical reasons. The
default has not been changed in order to maintain backwards
compatibility with existing uses of :class:`EmailField`.
``FileField``
@ -887,23 +887,9 @@ shortcuts.
``URLField``
------------
.. class:: URLField([verify_exists=False, max_length=200, **options])
.. class:: URLField([max_length=200, **options])
A :class:`CharField` for a URL. Has one extra optional argument:
.. deprecated:: 1.4
``verify_exists`` is deprecated for security reasons as of 1.4 and will be
removed in Django 1.5. Prior to 1.3.1, the default value was ``True``.
.. attribute:: URLField.verify_exists
If ``True``, the URL given will be checked for existence (i.e.,
the URL actually loads and doesn't give a 404 response) using a
``HEAD`` request. Redirects are allowed, but will not be followed.
Note that when you're using the single-threaded development server,
validating a URL being served by the same server will hang. This should not
be a problem for multithreaded servers.
A :class:`CharField` for a URL.
The admin represents this as an ``<input type="text">`` (a single-line input).

View file

@ -2148,18 +2148,6 @@ to ensure your processes are running in the correct environment.
.. _pytz: http://pytz.sourceforge.net/
.. setting:: URL_VALIDATOR_USER_AGENT
URL_VALIDATOR_USER_AGENT
------------------------
Default: ``Django/<version> (https://www.djangoproject.com/)``
The string to use as the ``User-Agent`` header when checking to see if
URLs exist (see the ``verify_exists`` option on
:class:`~django.db.models.URLField`). This setting was deprecated in
1.3.1 along with ``verify_exists`` and will be removed in 1.4.
.. setting:: USE_ETAGS
USE_ETAGS
@ -2344,3 +2332,12 @@ IGNORABLE_404_STARTS
.. deprecated:: 1.4
This setting has been superseded by :setting:`IGNORABLE_404_URLS`.
.. setting:: URL_VALIDATOR_USER_AGENT
URL_VALIDATOR_USER_AGENT
------------------------
.. deprecated:: 1.5
This value was used as the ``User-Agent`` header when checking if a URL
exists, a feature that was removed due to security and performance issues.

View file

@ -88,26 +88,10 @@ to, or in lieu of custom ``field.clean()`` methods.
``URLValidator``
----------------
.. class:: URLValidator([verify_exists=False, validator_user_agent=URL_VALIDATOR_USER_AGENT])
.. class:: URLValidator()
A :class:`RegexValidator` that ensures a value looks like a URL and
optionally verifies that the URL actually exists (i.e., doesn't return a
404 status code). Raises an error code of ``'invalid'`` if it doesn't look
like a URL, and a code of ``'invalid_link'`` if it doesn't exist.
:param verify_exists: Sets :attr:`verify_exists`. Defaults to ``False``.
:param validator_user_agent: Sets :attr:`validator_user_agent`. Defaults to
:setting:`URL_VALIDATOR_USER_AGENT` or, if that setting is set to a
null value, ``"Django (https://www.djangoproject.com/)"``.
.. attribute:: verify_exists
If set to ``True``, this validator checks that the URL actually exists.
.. attribute:: validator_user_agent
If :attr:`verify_exists` is ``True``, Django uses this value as the
"User-agent" for the request.
A :class:`RegexValidator` that ensures a value looks like a URL, and raises
an error code of ``'invalid'`` if it doesn't.
``validate_email``
------------------