From 0a87f4f4ebad66e758b1be0086ec308d8d5a37b9 Mon Sep 17 00:00:00 2001 From: Alen Mujezinovic Date: Mon, 12 Apr 2010 12:57:22 +0100 Subject: [PATCH] Auth backends catch now Model.DoesNotExist exceptions instead of all of them --- socialregistration/auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/socialregistration/auth.py b/socialregistration/auth.py index ddbe3c0..ba6cf2e 100644 --- a/socialregistration/auth.py +++ b/socialregistration/auth.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import User from django.contrib.sites.models import Site -from socialregistration.models import (FacebookProfile, TwitterProfile, FriendFeedProfile, OpenIDProfile) +from socialregistration.models import (FacebookProfile, TwitterProfile, OpenIDProfile) class Auth(object): def get_user(self, user_id): @@ -17,7 +17,7 @@ def authenticate(self, uid=None): uid=uid, site=Site.objects.get_current() ).user - except: + except FacebookProfile.DoesNotExist: return None class TwitterAuth(Auth): @@ -27,7 +27,7 @@ def authenticate(self, twitter_id=None): twitter_id=twitter_id, site=Site.objects.get_current() ).user - except: + except TwitterProfile.DoesNotExist: return None class OpenIDAuth(Auth): @@ -37,5 +37,5 @@ def authenticate(self, identity=None): identity=identity, site=Site.objects.get_current() ).user - except: + except OpenIDProfile.DoesNotExist: return None