From: Matías Aguirre Date: Fri, 10 Dec 2010 18:22:36 +0000 (-0200) Subject: Added missing module and remove debugging prints X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=43ab23ba3c0bc14c1faf6743ec75569c1b6d8823;p=django-social-auth.git Added missing module and remove debugging prints --- diff --git a/social_auth/backends.py b/social_auth/backends.py index 865d050..c921aaf 100644 --- a/social_auth/backends.py +++ b/social_auth/backends.py @@ -96,11 +96,8 @@ class SocialAuthBackend(ModelBackend): password=UNUSABLE_PASSWORD) # update details and associate account with social credentials - try: - self.update_user_details(user, response, details) - self.associate_auth(user, response, details) - except Exception, e: - print str(e) + self.update_user_details(user, response, details) + self.associate_auth(user, response, details) return user def associate_auth(self, user, response, details): @@ -211,8 +208,6 @@ class FacebookBackend(OAuthBackend): def get_user_details(self, response): """Return user details from Facebook account""" - import pprint - pprint.pprint(response) return {'email': response.get('email', ''), 'username': response['name'], 'fullname': response['name'], diff --git a/social_auth/signals.py b/social_auth/signals.py new file mode 100644 index 0000000..ed5a8ae --- /dev/null +++ b/social_auth/signals.py @@ -0,0 +1,19 @@ +"""Signals""" +from django.dispatch import Signal + +# Pre save signal +# This signal is sent when user instance values is about to be +# updated with new values from services provided. This way custom +# actions can be attached and values updated if needed before the +# saving time. +# +# Handlers must return True if any value was updated/changed, +# otherwise must return any non True value. +# +# The parameters passed are: +# sender: A social auth backend instance +# user: Current user instance (retrieved from db or recently +# created) +# response: Raw auth service response +# details: Processed details values (basic fields) +pre_update = Signal(providing_args=['user', 'response', 'details']) diff --git a/social_auth/views.py b/social_auth/views.py index 5334a65..bb47689 100644 --- a/social_auth/views.py +++ b/social_auth/views.py @@ -34,7 +34,6 @@ def complete(request, backend): return HttpResponseServerError('Incorrect authentication service') backend = BACKENDS[backend](request, request.path) user = backend.auth_complete() - print "USER:", user if user and user.is_active: login(request, user) url = request.session.pop(REDIRECT_FIELD_NAME, '') or \