diff options
author | Magnus Hagander | 2019-01-03 10:01:56 +0000 |
---|---|---|
committer | Magnus Hagander | 2019-01-03 10:01:56 +0000 |
commit | 46372add400ffa5295969aa2e4e8c468d4ada937 (patch) | |
tree | d54ab386c13780b3a778294804f6af1a21d88626 /django/archives/auth.py | |
parent | 98c6b19fae0c8d59d8752e5ee6cefd76e2d56c97 (diff) |
Use "in" syntax instead of has_key()
has_key() has been deprecated for a while and will be gone in Python3.
The in syntax is available in both the old and the new versions.
Diffstat (limited to 'django/archives/auth.py')
-rw-r--r-- | django/archives/auth.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/archives/auth.py b/django/archives/auth.py index 6cf2c80..b3af1a5 100644 --- a/django/archives/auth.py +++ b/django/archives/auth.py @@ -53,7 +53,7 @@ def login(request): from django.contrib.auth.views import login return login(request, template_name='admin.html') - if request.GET.has_key('next'): + if 'next' in request.GET: # Put together an url-encoded dict of parameters we're getting back, # including a small nonce at the beginning to make sure it doesn't # encrypt the same way every time. @@ -82,13 +82,13 @@ def logout(request): # Receive an authentication response from the main website and try # to log the user in. def auth_receive(request): - if request.GET.has_key('s') and request.GET['s'] == "logout": + if 's' in request.GET and request.GET['s'] == "logout": # This was a logout request return HttpResponseRedirect('/') - if not request.GET.has_key('i'): + if 'i' not in request.GET: return HttpResponse("Missing IV in url!", status=400) - if not request.GET.has_key('d'): + if 'd' not in request.GET: return HttpResponse("Missing data in url!", status=400) # Set up an AES object and decrypt the data we received @@ -170,7 +170,7 @@ We apologize for the inconvenience. # Finally, check of we have a data package that tells us where to # redirect the user. - if data.has_key('d'): + if 'd' in data: (ivs, datas) = data['d'][0].split('$') decryptor = AES.new(SHA.new(settings.SECRET_KEY).digest()[:16], AES.MODE_CBC, @@ -180,7 +180,7 @@ We apologize for the inconvenience. rdata = urlparse.parse_qs(s, strict_parsing=True) except ValueError: return HttpResponse("Invalid encrypted data received.", status=400) - if rdata.has_key('r'): + if 'r' in rdata: # Redirect address return HttpResponseRedirect(rdata['r'][0]) # No redirect specified, see if we have it in our settings |