Created
October 22, 2015 17:00
-
-
Save pmclanahan/fdd3635aa0b5cde96cfe to your computer and use it in GitHub Desktop.
A view that redirects based on waffle, keeping query params.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponseRedirect | |
from django.utils.encoding import force_text | |
import waffle | |
from bedrock.base.urlresolvers import reverse | |
from lib.l10n_utils import render | |
def choose_view(request): | |
if waffle.switch_is_active('tracking-protection'): | |
return render(request, 'firefox/tracking-protection.html') | |
else: | |
query = force_text(request.META.get('QUERY_STRING'), errors='ignore') | |
return HttpResponseRedirect('?'.join([reverse('firefox.new'), query])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment