From 0ad033550cb379c6fbe6fe4b227c97e0b8f7464d Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Wed, 28 May 2014 14:58:37 -0700 Subject: [PATCH] Fix auth key bug introduced in last change --- lib/auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/auth.py b/lib/auth.py index 4a92c5d..312bd15 100644 --- a/lib/auth.py +++ b/lib/auth.py @@ -37,10 +37,10 @@ def GetAuthKey(): if _AUTH_KEY: return _AUTH_KEY[0] - for key in AuthKey.all().filter('live =', True): - auth_key = key.auth_key - - if not auth_key: + auth_keys = AuthKey.all().filter('live =', True).fetch(1) + if auth_keys: + auth_key = auth_keys[0].auth_key + else: auth_key = ''.join(random.choice(_KEY_CHARS) for _ in xrange(_KEY_LENGTH)) AuthKey(auth_key=auth_key).put()