From ca7cbceb4a2ee537861bd136950c68f96fc9cf9d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 14 Apr 2013 01:44:37 -0400 Subject: [PATCH] Silly SQL, that's not what I told you to do. --- earwigbot/config/permissions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/earwigbot/config/permissions.py b/earwigbot/config/permissions.py index eb8c7ad..d3acb88 100644 --- a/earwigbot/config/permissions.py +++ b/earwigbot/config/permissions.py @@ -183,10 +183,10 @@ class PermissionsDB(object): query3 = """UPDATE attributes SET attr_value = ? WHERE attr_uid = ? AND attr_key = ?""" with self._db_access_lock, sqlite.connect(self._dbfile) as conn: - if conn.execute(query1, (user, key)): - conn.execute(query2, (user, key, value)) - else: + if conn.execute(query1, (user, key)).fetchone(): conn.execute(query3, (value, user, key)) + else: + conn.execute(query2, (user, key, value)) try: self._attributes[user][key] = value except KeyError: