Wrap long condition in language redirect middleware
This commit is contained in:
@@ -80,7 +80,10 @@ class FirstVisitLanguageRedirectMiddleware:
|
|||||||
matched = get_language_from_request(request, check_path=False)
|
matched = get_language_from_request(request, check_path=False)
|
||||||
if matched:
|
if matched:
|
||||||
normalized = matched.split("-")[0].lower()
|
normalized = matched.split("-")[0].lower()
|
||||||
if normalized in self.supported_languages and normalized != self.default_language:
|
if (
|
||||||
|
normalized in self.supported_languages
|
||||||
|
and normalized != self.default_language
|
||||||
|
):
|
||||||
return normalized
|
return normalized
|
||||||
|
|
||||||
# Fallback to raw Accept-Language parsing for unprefixed default routes.
|
# Fallback to raw Accept-Language parsing for unprefixed default routes.
|
||||||
|
|||||||
Reference in New Issue
Block a user