From ec7044c706f48f5ab3d9e4c35e4078b9f9dcaaf2 Mon Sep 17 00:00:00 2001 From: Ahmed Nassar Date: Sat, 8 Mar 2025 16:35:10 +0200 Subject: Fixed #36000 -- Deprecated HTTP as the default protocol in urlize and urlizetrunc. --- docs/internals/deprecation.txt | 5 +++++ docs/ref/settings.txt | 16 ++++++++++++++++ docs/ref/templates/builtins.txt | 40 ++++++++++++++++++++++++++++++++++------ docs/releases/6.0.txt | 7 +++++++ 4 files changed, 62 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 15a44e78e4..1ac2c291e0 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -23,6 +23,11 @@ details on these changes. * The ``django.contrib.postgres.aggregates.mixins.OrderableAggMixin`` class will be removed. +* The default protocol in ``urlize`` and ``urlizetrunc`` template filters will + change from HTTP to HTTPS. + +* The ``URLIZE_ASSUME_HTTPS`` transitional setting will be removed. + .. _deprecation-removed-in-6.1: 6.1 diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 556cbb4b1e..ab82b539b0 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -2955,6 +2955,21 @@ enabled if a proxy which sets this header is in use. :setting:`USE_X_FORWARDED_HOST` takes priority over this setting. +.. setting:: URLIZE_ASSUME_HTTPS + +``URLIZE_ASSUME_HTTPS`` +----------------------- + +.. versionadded:: 6.0 +.. deprecated:: 6.0 + +Default: ``False`` + +Set this transitional setting to ``True`` to opt into using HTTPS as the +default protocol when none is provided in URLs processed by the +:tfilter:`urlize` and :tfilter:`urlizetrunc` template filters during the Django +6.x release cycle. + .. setting:: WSGI_APPLICATION ``WSGI_APPLICATION`` @@ -3766,6 +3781,7 @@ Security * :setting:`SECRET_KEY` * :setting:`SECRET_KEY_FALLBACKS` +* :setting:`URLIZE_ASSUME_HTTPS` * :setting:`X_FRAME_OPTIONS` Serialization diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 247f5e9890..f5470ad0eb 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -2905,9 +2905,23 @@ For example: {{ value|urlize }} -If ``value`` is ``"Check out www.djangoproject.com"``, the output will be -``"Check out www.djangoproject.com"``. +If ``value`` is ``"Check out www.djangoproject.com"``, the output will be: + +.. code-block:: html+django + + Check out www.djangoproject.com + +.. deprecated:: 6.0 + + The default protocol when none is provided will change from HTTP to HTTPS + in Django 7.0. Hence, the output will become: + + .. code-block:: html+django + + Check out www.djangoproject.com + + Set the transitional setting :setting:`URLIZE_ASSUME_HTTPS` to ``True`` to + opt into using HTTPS during the Django 6.x release cycle. In addition to web links, ``urlize`` also converts email addresses into ``mailto:`` links. If ``value`` is @@ -2942,9 +2956,23 @@ For example: {{ value|urlizetrunc:15 }} -If ``value`` is ``"Check out www.djangoproject.com"``, the output would be -``'Check out www.djangoproj…'``. +If ``value`` is ``"Check out www.djangoproject.com"``, the output would be: + +.. code-block:: html+django + + Check out www.djangoproj… + +.. deprecated:: 6.0 + + The default protocol when none is provided will change from HTTP to HTTPS + in Django 7.0. Hence, the output will become: + + .. code-block:: html+django + + Check out www.djangoproj… + + Set the transitional setting :setting:`URLIZE_ASSUME_HTTPS` to ``True`` to + opt into using HTTPS during the Django 6.x release cycle. As with urlize_, this filter should only be applied to plain text. diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index c604638deb..2cbab2dace 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -321,6 +321,13 @@ Miscellaneous * The PostgreSQL ``OrderableAggMixin`` is deprecated in favor of the ``order_by`` attribute now available on the ``Aggregate`` class. +* The default protocol in :tfilter:`urlize` and :tfilter:`urlizetrunc` will + change from HTTP to HTTPS in Django 7.0. Set the transitional setting + ``URLIZE_ASSUME_HTTPS`` to ``True`` to opt into assuming HTTPS during the + Django 6.x release cycle. + +* ``URLIZE_ASSUME_HTTPS`` transitional setting is deprecated. + Features removed in 6.0 ======================= -- cgit v1.3