Skip to content

Commit

Permalink
Merge pull request #98 from terrycojones/has_key-cleanup
Browse files Browse the repository at this point in the history
Remove use of deprecated has_key.
  • Loading branch information
pennersr committed Sep 3, 2012
2 parents 905ca40 + 73268df commit 782975d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions allauth/account/views.py
Expand Up @@ -158,7 +158,7 @@ def email(request, **kwargs):
template_name = kwargs.pop("template_name", "account/email.html")
sync_user_email_addresses(request.user)
if request.method == "POST" and request.user.is_authenticated():
if request.POST.has_key("action_add"):
if "action_add" in request.POST:
add_email_form = form_class(request.user, request.POST)
if add_email_form.is_valid():
add_email_form.save()
Expand All @@ -171,7 +171,7 @@ def email(request, **kwargs):
else:
add_email_form = form_class()
if request.POST.get("email"):
if request.POST.has_key("action_send"):
if "action_send" in request.POST:
email = request.POST["email"]
try:
email_address = EmailAddress.objects.get(
Expand All @@ -187,7 +187,7 @@ def email(request, **kwargs):
return HttpResponseRedirect(reverse('account_email'))
except EmailAddress.DoesNotExist:
pass
elif request.POST.has_key("action_remove"):
elif "action_remove" in request.POST:
email = request.POST["email"]
try:
email_address = EmailAddress.objects.get(
Expand All @@ -210,7 +210,7 @@ def email(request, **kwargs):
return HttpResponseRedirect(reverse('account_email'))
except EmailAddress.DoesNotExist:
pass
elif request.POST.has_key("action_primary"):
elif "action_primary" in request.POST:
email = request.POST["email"]
try:
email_address = EmailAddress.objects.get(
Expand Down
2 changes: 1 addition & 1 deletion allauth/socialaccount/providers/oauth/client.py
Expand Up @@ -94,7 +94,7 @@ def get_access_token(self):
# Passing along oauth_verifier is required according to:
# http://groups.google.com/group/twitter-development-talk/browse_frm/thread/472500cfe9e7cdb9#
# Though, the custom oauth_callback seems to work without it?
if self.request.REQUEST.has_key('oauth_verifier'):
if 'oauth_verifier' in self.request.REQUEST:
at_url = at_url + '?' + urllib.urlencode({'oauth_verifier': self.request.REQUEST['oauth_verifier']})
response, content = self.client.request(at_url, "GET")
if response['status'] != '200':
Expand Down
2 changes: 1 addition & 1 deletion allauth/socialaccount/providers/oauth/views.py
Expand Up @@ -63,7 +63,7 @@ def dispatch(self, request):
login_done_url = reverse(self.adapter.provider_id + "_callback")
client = self._get_client(request, login_done_url)
if not client.is_valid():
if request.GET.has_key('denied'):
if 'denied' in request.GET:
return HttpResponseRedirect(reverse('socialaccount_login_cancelled'))
extra_context = dict(oauth_client=client)
return render_authentication_error(request, extra_context)
Expand Down
2 changes: 1 addition & 1 deletion allauth/socialaccount/providers/openid/tests.py
Expand Up @@ -13,4 +13,4 @@ def test_discovery_failure(self):
"""
resp = self.client.post(reverse(views.login),
dict(openid='http://www.google.com'))
self.assertTrue(resp.context['form'].errors.has_key('openid'))
self.assertTrue('openid' in resp.context['form'].errors)
2 changes: 1 addition & 1 deletion allauth/socialaccount/providers/openid/views.py
Expand Up @@ -36,7 +36,7 @@ def _openid_consumer(request):


def login(request):
if request.GET.has_key('openid') or request.method == 'POST':
if 'openid' in request.GET or request.method == 'POST':
form = LoginForm(request.REQUEST)
if form.is_valid():
client = _openid_consumer(request)
Expand Down
2 changes: 1 addition & 1 deletion allauth/socialaccount/templatetags/socialaccount.py
Expand Up @@ -16,7 +16,7 @@ def render(self, context):
query = dict([(str(name), var.resolve(context)) for name, var
in self.params.iteritems()])
request = context['request']
if not query.has_key('next'):
if 'next' not in query:
next = request.REQUEST.get('next')
if next:
query['next'] = next
Expand Down

0 comments on commit 782975d

Please sign in to comment.