From b99b3100670f97f1301e5ada4b5d8f536e084f11 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Tue, 25 Sep 2018 12:14:42 +0100 Subject: [PATCH] simplify the lookup of where to send the user --- opentech/public/mailchimp/views.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/opentech/public/mailchimp/views.py b/opentech/public/mailchimp/views.py index ed0ede580..0c1bdf805 100644 --- a/opentech/public/mailchimp/views.py +++ b/opentech/public/mailchimp/views.py @@ -79,11 +79,7 @@ class MailchimpSubscribeView(FormMixin, RedirectView): def get_success_url(self): # Go back to where you came from, default to front page. - origin = '/' - if 'HTTP_ORIGIN' in self.request.META: - origin = self.request.META['HTTP_ORIGIN'] - elif 'HTTP_REFERER' in self.request.META: - origin = self.request.META['HTTP_REFERER'] + origin = self.request.META.get('HTTP_ORIGIN') or self.request.META.get('HTTP_REFERER') or '/' # Add cache busting query string. return origin + '?newsletter-' + uuid.uuid4().hex -- GitLab