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)
|
||||
if matched:
|
||||
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
|
||||
|
||||
# Fallback to raw Accept-Language parsing for unprefixed default routes.
|
||||
|
||||
Reference in New Issue
Block a user