From 55a760a54e1e49b74c980e4cfa79a4b6054c5d9b Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Tue, 9 Jul 2013 12:17:11 +0530 Subject: [PATCH] Add backward compatible code for registered user list Production database still contains users as 'author' instead of 'who'. So backward compatible code is needed to workaround, else the script fails with a 500(KeyError). --- swtr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/swtr.py b/swtr.py index 6ba98ac..1558d21 100644 --- a/swtr.py +++ b/swtr.py @@ -247,8 +247,11 @@ def make_list(res): for row in res: d = row d['id'] = str(row['_id']) - if d['who'] in getUsers(): - d['registered'] = True + try: + if d['who'] in getUsers() || d['author'] in getUsers(): + d['registered'] = True + except KeyError: + pass entries.append(d) return entries -- 1.7.10.4