Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Add own tuple_index function to stay compatible with python 2.5"

This reverts commit 7e6af72.
  • Loading branch information...
commit 2a2c9e01b51b10594da97c5ce273073931e44c43 1 parent 7e6af72
@Jolmberg authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 social_auth/backends/pipeline/misc.py
View
18 social_auth/backends/pipeline/misc.py
@@ -4,22 +4,18 @@
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)
Please sign in to comment.
Something went wrong with that request. Please try again.