From d9c3705c47cc0b39eb2c563b821387d460644686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 17 Oct 2017 12:40:33 +0200 Subject: [PATCH] Fix tuples in existing session['blender_id_oauth_token'] In a past version of Pillar we accidentally stored tuples in the session. Such sessions should be actively fixed. --- pillar/auth/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pillar/auth/__init__.py b/pillar/auth/__init__.py index 91337013..95902b1b 100644 --- a/pillar/auth/__init__.py +++ b/pillar/auth/__init__.py @@ -219,6 +219,13 @@ def get_blender_id_oauth_token() -> str: token = session.get('blender_id_oauth_token') if token: + if isinstance(token, (tuple, list)): + # In a past version of Pillar we accidentally stored tuples in the session. + # Such sessions should be actively fixed. + # TODO(anyone, after 2017-12-01): refactor this if-block so that it just converts + # the token value to a string and use that instead. + token = token[0] + session['blender_id_oauth_token'] = token return token if request.authorization and request.authorization.username: