From 30ccd3750513c006140f827a9d8ee6accde6cf19 Mon Sep 17 00:00:00 2001 From: Lynne Date: Thu, 12 Sep 2019 21:31:19 +1000 Subject: [PATCH] fix potential reference before assignment --- webui.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webui.py b/webui.py index 60132bd..8c61ef2 100644 --- a/webui.py +++ b/webui.py @@ -36,7 +36,8 @@ def home(): bot_count = c.fetchone()[0] active_count = None bots = {} - bot_users = None + bot_users = {} + next_posts = {} if bot_count > 0: c.execute("SELECT COUNT(*) FROM `bots` WHERE user_id = %s AND enabled = TRUE", (session['user_id'],)) @@ -45,8 +46,6 @@ def home(): dc.execute("SELECT `handle`, `enabled`, `last_post`, `post_frequency` FROM `bots` WHERE user_id = %s", (session['user_id'],)) bots = dc.fetchall() dc.close() - bot_users = {} - next_posts = {} for bot in bots: # multiple SELECTS is slow, maybe SELECT all at once and filter with python?