mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[5.1.x] Fixed #35627 -- Raised a LookupError rather than an unhandled ValueError in get_supported_language_variant().
LocaleMiddleware didn't handle the ValueError raised by get_supported_language_variant() when language codes were over 500 characters. Regression in9e9792228a. Backport of0e94f292cdfrom main.
This commit is contained in:
committed by
Sarah Boyce
parent
d9d77de2f6
commit
741f33eaf1
@@ -1108,7 +1108,7 @@ For a complete discussion on the usage of the following see the
|
||||
``'es-ar'`` isn't.
|
||||
|
||||
``lang_code`` has a maximum accepted length of 500 characters. A
|
||||
:exc:`ValueError` is raised if ``lang_code`` exceeds this limit and
|
||||
:exc:`LookupError` is raised if ``lang_code`` exceeds this limit and
|
||||
``strict`` is ``True``, or if there is no generic variant and ``strict``
|
||||
is ``False``.
|
||||
|
||||
@@ -1120,10 +1120,10 @@ For a complete discussion on the usage of the following see the
|
||||
|
||||
Raises :exc:`LookupError` if nothing is found.
|
||||
|
||||
.. versionchanged:: 4.2.14
|
||||
.. versionchanged:: 4.2.15
|
||||
|
||||
In older versions, ``lang_code`` values over 500 characters were
|
||||
processed without raising a :exc:`ValueError`.
|
||||
processed without raising a :exc:`LookupError`.
|
||||
|
||||
.. function:: to_locale(language)
|
||||
|
||||
|
||||
14
docs/releases/4.2.15.txt
Normal file
14
docs/releases/4.2.15.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
===========================
|
||||
Django 4.2.15 release notes
|
||||
===========================
|
||||
|
||||
*Expected August 6, 2024*
|
||||
|
||||
Django 4.2.15 fixes a regression in 4.2.14.
|
||||
|
||||
Bugfixes
|
||||
========
|
||||
|
||||
* Fixed a regression in Django 4.2.14 that caused a crash in
|
||||
``LocaleMiddleware`` when processing a language code over 500 characters
|
||||
(:ticket:`35627`).
|
||||
@@ -19,3 +19,7 @@ Bugfixes
|
||||
* Fixed a crash when creating a model with a ``Field.db_default`` and a
|
||||
``Meta.constraints`` constraint composed of ``__endswith``, ``__startswith``,
|
||||
or ``__contains`` lookups (:ticket:`35625`).
|
||||
|
||||
* Fixed a regression in Django 5.0.7 that caused a crash in
|
||||
``LocaleMiddleware`` when processing a language code over 500 characters
|
||||
(:ticket:`35627`).
|
||||
|
||||
@@ -48,6 +48,7 @@ versions of the documentation contain the release notes for any later releases.
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
4.2.15
|
||||
4.2.14
|
||||
4.2.13
|
||||
4.2.12
|
||||
|
||||
Reference in New Issue
Block a user