]> git.parisson.com Git - django-social-auth.git/commitdiff
Revert "Add own tuple_index function to stay compatible with python 2.5"
authorJohannes Holmberg <johannes@update.uu.se>
Thu, 16 Feb 2012 14:24:07 +0000 (15:24 +0100)
committerJohannes Holmberg <johannes@update.uu.se>
Thu, 16 Feb 2012 14:24:07 +0000 (15:24 +0100)
This reverts commit 7e6af723e15a785b403010de4b44b49fce924e91.

social_auth/backends/pipeline/misc.py

index 752b5450959299e4dc9b8918ef1669eb4e209ccf..22b0e19740a866948a0b5cb53dd91f213ad74d85 100644 (file)
@@ -4,22 +4,18 @@ from social_auth.utils import setting
 
 PIPELINE_ENTRY = 'social_auth.backends.pipeline.misc.save_status_to_session'
 
-def tuple_index(t, e):
-    for (i, te) in enumerate(t):
-        if te == e:
-            return i
-    return None
 
 def save_status_to_session(request, auth, *args, **kwargs):
     """Saves current social-auth status to session."""
     next_entry = setting('SOCIAL_AUTH_PIPELINE_RESUME_ENTRY')
 
-    if next_entry:
-        idx = tuple_index(PIPELINE, next_entry)
-    else:
-        idx = tuple_index(PIPELINE, PIPELINE_ENTRY)
-        if idx:
-            idx += 1
+    try:
+        if next_entry:
+            idx = PIPELINE.index(next_entry)
+        else:
+            idx = PIPELINE.index(PIPELINE_ENTRY) + 1
+    except ValueError:
+        idx = None
 
     data = auth.to_session_dict(idx, *args, **kwargs)