request_cookie request GET get request_cookie None if not request_cook

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
request_cookie = request.GET.get('request_cookie', None)
if not request_cookie is None:
redirect_url = request.GET.get('redirect_url', None)
response = HttpResponseRedirect('http://%s' % redirect_url)
session_key = request.session.session_key
response.set_cookie(settings.SESSION_COOKIE_NAME,
session_key, max_age=None,
expires=None, domain=settings.SESSION_COOKIE_DOMAIN,
path=settings.SESSION_COOKIE_PATH,
secure=settings.SESSION_COOKIE_SECURE or None)
return HttpResponseRedirect(response)