From 9249e0a095280b0d6c037c2a8043812d9ac10ba0 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 30 Jan 2018 20:34:14 +0000 Subject: [PATCH] convert list of auth_codes to single value The auth tests use parse_qs() which always returns a list for a name. The MySQL driver apparently converts the list to a single string, but the sqlite3 driver does not so do it ourselves in authorization_code_get() before accessing the database. Change-Id: Ib68a7b2c8c51b8762b595e31c4d6d2878d116b91 Signed-off-by: Doug Hellmann --- storyboard/db/api/auth_codes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storyboard/db/api/auth_codes.py b/storyboard/db/api/auth_codes.py index 17be2a36..179841fa 100644 --- a/storyboard/db/api/auth_codes.py +++ b/storyboard/db/api/auth_codes.py @@ -20,6 +20,10 @@ from storyboard.db import models def authorization_code_get(code): query = api_base.model_query(models.AuthorizationCode, api_base.get_session()) + # The query string parser always gives a list, but the database + # wants a single value. + if isinstance(code, list): + code = code[0] return query.filter_by(code=code).first()