From 950db1de8ee3f3e98c2bf027ba539b3af44ee35c Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 2 Sep 2019 16:47:49 +1000 Subject: [PATCH] fix bot creation and home pages --- templates/home.html | 4 ++-- webui.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/home.html b/templates/home.html index 8f7aaab..25c2c0f 100644 --- a/templates/home.html +++ b/templates/home.html @@ -22,10 +22,10 @@
{{ bot['handle'] }}
-
{% if bot['enabled'] %}Online{% else %}Offline{% endif %}, learning from {{ bot_users[bot['id']] }} accounts
+
{% if bot['enabled'] %}Online{% else %}Offline{% endif %}, learning from {{ bot_users[bot['handle']] }} accounts
- +
{% endfor %} diff --git a/webui.py b/webui.py index 60f2bc1..4368ca5 100644 --- a/webui.py +++ b/webui.py @@ -35,7 +35,7 @@ def home(): c.execute("SELECT COUNT(*) FROM `bots` WHERE user_id = %s AND enabled = TRUE", (session['user_id'],)) active_count = c.fetchone()[0] dc = mysql.connection.cursor(MySQLdb.cursors.DictCursor) - dc.execute("SELECT handle` FROM `bots` WHERE user_id = %s", (session['user_id'],)) + dc.execute("SELECT `handle` FROM `bots` WHERE user_id = %s", (session['user_id'],)) bots = dc.fetchall() dc.close() bot_users = {} @@ -156,7 +156,8 @@ def bot_create(): session['step'] = 1 return bot_create() - elif session['step'] == 4: + else: + if session['step'] == 4: try: # test authentication client = Mastodon(client_id=session['client_id'], client_secret=session['client_secret'], api_base_url=session['instance']) @@ -175,7 +176,6 @@ def bot_create(): c.execute("INSERT INTO `bots` (handle, user_id, credentials_id) VALUES (%s, %s, %s)", (handle, session['user_id'], credentials_id)) mysql.connection.commit() - c.close() # clean up unneeded variables