Skip to content

Commit

Permalink
Remove request parameter from get_locale_or_redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
ayanaar committed Nov 17, 2023
1 parent 7a039c5 commit aef18d4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pontoon/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def get_project_or_redirect(
raise Http404


def get_locale_or_redirect(code, request, redirect_view_name, url_arg_name, **kwargs):
def get_locale_or_redirect(code, redirect_view_name, url_arg_name, **kwargs):
"""
Attempts to retrieve a locale using the given code. If the locale does not exist, it checks the LocaleCodeHistory
for a record of the old code. If an entry is found, it redirects to the view specified by redirect_view_name
Expand Down
4 changes: 2 additions & 2 deletions pontoon/contributors/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def settings(request):
# Set custom homepage selector value
custom_homepage_code = profile.custom_homepage
custom_homepage_locale = get_locale_or_redirect(
custom_homepage_code, request, "pontoon.contributors.views.settings", "locale"
custom_homepage_code, "pontoon.contributors.views.settings", "locale"
)
if isinstance(custom_homepage_locale, HttpResponseRedirect):
return custom_homepage_locale
Expand All @@ -326,7 +326,7 @@ def settings(request):
# Set preferred source locale
preferred_source_code = profile.preferred_source_locale
preferred_source_locale = get_locale_or_redirect(
preferred_source_code, request, "pontoon.contributors.views.settings", "locale"
preferred_source_code, "pontoon.contributors.views.settings", "locale"
)
if isinstance(preferred_source_locale, HttpResponseRedirect):
return preferred_source_locale
Expand Down
2 changes: 1 addition & 1 deletion pontoon/localizations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
def localization(request, code, slug):
"""Locale-project overview."""
locale = get_locale_or_redirect(
code, request, "pontoon.localizations.localization", "code", slug=slug
code, "pontoon.localizations.localization", "code", slug=slug
)
if isinstance(locale, HttpResponseRedirect):
return locale
Expand Down
2 changes: 1 addition & 1 deletion pontoon/teams/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def teams(request):

def team(request, locale):
"""Team dashboard."""
locale = get_locale_or_redirect(locale, request, "pontoon.teams.team", "locale")
locale = get_locale_or_redirect(locale, "pontoon.teams.team", "locale")
if isinstance(locale, HttpResponseRedirect):
return locale
available_count = locale.project_set.available().visible_for(request.user).count()
Expand Down
1 change: 0 additions & 1 deletion pontoon/translate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def translate(request, locale, project, resource):
# Validate Locale
locale = get_locale_or_redirect(
locale,
request,
"pontoon.translate",
"locale",
project=project,
Expand Down

0 comments on commit aef18d4

Please sign in to comment.