diff options
| author | Lorenzo Peña <lorinkoz@gmail.com> | 2024-07-23 12:06:29 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-07-25 09:38:46 +0200 |
| commit | 0e94f292cda632153f2b3d9a9037eb0141ae9c2e (patch) | |
| tree | b4441d84b721f8154afa9ebd9b4db22e0fc89f13 /django/utils/translation | |
| parent | 2c024c9ac096d06d9e78d1ae02b52f73a45eadf8 (diff) | |
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 in 9e9792228a6bb5d6402a5d645bc3be4cf364aefb.
Diffstat (limited to 'django/utils/translation')
| -rw-r--r-- | django/utils/translation/trans_real.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 4439fdad3f..1c42330451 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -517,7 +517,7 @@ def get_supported_language_variant(lang_code, strict=False): # There is a generic variant under the maximum length accepted length. lang_code = lang_code[:index] else: - raise ValueError("'lang_code' exceeds the maximum accepted length") + raise LookupError(lang_code) # If 'zh-hant-tw' is not supported, try special fallback or subsequent # language codes i.e. 'zh-hant' and 'zh'. possible_lang_codes = [lang_code] |
