From 7dbdb8037a64fa0ce718c5b4dfbb5d0b79d57058 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 30 Aug 2019 18:01:32 -0700 Subject: [PATCH] views: Fix failure in redirecting from language selection page is_safe_url() expects allowed_hosts argument instead of host. This is an internal method. Found by reviewing the release notes for Django 2.0, 2.1 and 2.2. This should be final change needed for Django 2.2 support. Closes: #1518. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plinth/views.py b/plinth/views.py index f2205be0c..42aaae7e0 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -101,7 +101,8 @@ class LanguageSelectionView(FormView): """Return the URL in the next parameter or home page.""" redirect_to = self.request.GET.get(REDIRECT_FIELD_NAME, '') redirect_to = self.request.POST.get(REDIRECT_FIELD_NAME, redirect_to) - if is_safe_url(url=redirect_to, host=self.request.get_host()): + if is_safe_url(url=redirect_to, + allowed_hosts={self.request.get_host()}): return redirect_to return reverse('index')