[Python-modules-commits] [python-social-auth] 80/322: properly handle data, so that it is more future proof, again. This time fix issue with team_url

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:12:51 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 dbab84921539222ca7d90d4fac49c089decd6694
Author: Nick Sullivan <nick at sullivanflock.com>
Date:   Wed Jan 7 15:26:26 2015 -0800

    properly handle data, so that it is more future proof, again. This time fix issue with team_url
---
 social/backends/slack.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/social/backends/slack.py b/social/backends/slack.py
index d2973ca..bd02e15 100644
--- a/social/backends/slack.py
+++ b/social/backends/slack.py
@@ -26,7 +26,7 @@ class SlackOAuth2(BaseOAuth2):
 
         # Build the username with the team $username@$team_url
         # Necessary to get unique names for all of slack
-        match = re.search("//([^.]+)\.slack\.com", response["team_url"])
+        match = re.search("//([^.]+)\.slack\.com", response["url"])
         username = "%s@%s" % (response.get("name"), match.group(1))
 
         return {'username': username,
@@ -51,15 +51,15 @@ class SlackOAuth2(BaseOAuth2):
             'user': auth_test.get("user_id")
         })
 
-        # Capture the user data, if available based on the scope
         if data.get("user"):
-            out = data["user"].copy()
-            # inject the team data
-            out["team_id"] = auth_test.get("team_id")
-            out["team"] = auth_test.get("team")
-            out["team_url"] = auth_test.get("url")
+            # Capture the user data, if available based on the scope
+            out = data["user"]
         else:
-            out = data.copy()
-            out.update(auth_test)
+            # Otherwise, grab whatever is available
+            out = data
+
+        # inject the auth/team data. Most notably so we can get the slack url,
+        # for creating unique usernames
+        out.update(auth_test)
 
         return out

-- 
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