Fix Factoids

This commit is contained in:
Valentin Lorentz 2011-01-02 09:31:07 +01:00
parent 6e6fd58ea7
commit 3582286658

View File

@ -284,7 +284,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
if cursor.rowcount == 0: if cursor.rowcount == 0:
irc.error(_('There is no such factoid.')) irc.error(_('There is no such factoid.'))
elif cursor.rowcount == 1 or number is True: elif cursor.rowcount == 1 or number is True:
(id, _) = cursor.fetchone() (id, foo) = cursor.fetchone()
cursor.execute("""DELETE FROM factoids WHERE key_id=%s""", id) cursor.execute("""DELETE FROM factoids WHERE key_id=%s""", id)
cursor.execute("""DELETE FROM keys WHERE key LIKE %s""", key) cursor.execute("""DELETE FROM keys WHERE key LIKE %s""", key)
db.commit() db.commit()
@ -293,7 +293,7 @@ class Factoids(callbacks.Plugin, plugins.ChannelDBHandler):
if number is not None: if number is not None:
results = cursor.fetchall() results = cursor.fetchall()
try: try:
(_, id) = results[number-1] (foo, id) = results[number-1]
except IndexError: except IndexError:
irc.error(_('Invalid factoid number.')) irc.error(_('Invalid factoid number.'))
return return