[Python-modules-commits] [python-social-auth] 308/322: Avoid storing empty values from user details

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:13:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.10
in repository python-social-auth.

commit b53e4dd48116e255f0a1e145f4e9d2bd21cd3722
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date:   Fri May 29 13:11:04 2015 -0300

    Avoid storing empty values from user details
---
 social/pipeline/user.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/social/pipeline/user.py b/social/pipeline/user.py
index f4fcd64..2157917 100644
--- a/social/pipeline/user.py
+++ b/social/pipeline/user.py
@@ -83,12 +83,11 @@ def user_details(strategy, details, user=None, *args, **kwargs):
         # example username and id fields. It's also possible to disable update
         # on fields defined in SOCIAL_AUTH_PROTECTED_FIELDS.
         for name, value in details.items():
-            if not hasattr(user, name):
-                continue
-            current_value = getattr(user, name, None)
-            if not current_value or name not in protected:
-                changed |= current_value != value
-                setattr(user, name, value)
+            if value and hasattr(user, name):
+                current_value = getattr(user, name, None)
+                if current_value is None or name not in protected:
+                    changed |= current_value != value
+                    setattr(user, name, value)
 
         if changed:
             strategy.storage.user.changed(user)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list