]> git.parisson.com Git - django-social-auth.git/commitdiff
Added missing module and remove debugging prints
authorMatías Aguirre <matiasaguirre@gmail.com>
Fri, 10 Dec 2010 18:22:36 +0000 (16:22 -0200)
committerMatías Aguirre <matiasaguirre@gmail.com>
Fri, 10 Dec 2010 18:22:36 +0000 (16:22 -0200)
social_auth/backends.py
social_auth/signals.py [new file with mode: 0644]
social_auth/views.py

index 865d050f42360ecacd9d96cb0135247b795906a1..c921aaf15e9c6ee08795d9491c0030632a69f88a 100644 (file)
@@ -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 (file)
index 0000000..ed5a8ae
--- /dev/null
@@ -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'])
index 5334a65498419be4fa2942471affafa09b57ca1e..bb476891bdf5430b3a18f0a5f31ac4b05cedc2a0 100644 (file)
@@ -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 \