From: Johannes Holmberg Date: Thu, 16 Feb 2012 14:24:07 +0000 (+0100) Subject: Revert "Add own tuple_index function to stay compatible with python 2.5" X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2a2c9e01b51b10594da97c5ce273073931e44c43;p=django-social-auth.git Revert "Add own tuple_index function to stay compatible with python 2.5" This reverts commit 7e6af723e15a785b403010de4b44b49fce924e91. --- diff --git a/social_auth/backends/pipeline/misc.py b/social_auth/backends/pipeline/misc.py index 752b545..22b0e19 100644 --- a/social_auth/backends/pipeline/misc.py +++ b/social_auth/backends/pipeline/misc.py @@ -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)