Changed all %d's to %s's

This commit is contained in:
Daniel DiPaolo 2003-10-29 22:05:53 +00:00
parent e5e507f3d9
commit 0011fff94e
3 changed files with 10 additions and 12 deletions

View File

@ -85,9 +85,7 @@ class Dunno(callbacks.Privmsg):
FROM dunnos FROM dunnos
ORDER BY random() ORDER BY random()
LIMIT 1""") LIMIT 1""")
if cursor.rowcount == 0: if cursor.rowcount != 0:
irc.error(msg, 'No dunnos available, add some with dunno add.')
else:
dunno = cursor.fetchone()[0] dunno = cursor.fetchone()[0]
dunno = dunno.replace('$who', msg.nick) dunno = dunno.replace('$who', msg.nick)
irc.reply(msg, dunno, prefixName=False) irc.reply(msg, dunno, prefixName=False)
@ -130,7 +128,7 @@ class Dunno(callbacks.Privmsg):
FROM dunnos FROM dunnos
WHERE id = %s""" % dunno_id) WHERE id = %s""" % dunno_id)
if cursor.rowcount == 0: if cursor.rowcount == 0:
irc.error(msg, 'No dunno with id: %d' % dunno_id) irc.error(msg, 'No dunno with id: %s' % dunno_id)
return return
(added_by, dunno) = cursor.fetchone() (added_by, dunno) = cursor.fetchone()
if not (ircdb.checkCapability(user_id, 'admin') or \ if not (ircdb.checkCapability(user_id, 'admin') or \
@ -157,7 +155,7 @@ class Dunno(callbacks.Privmsg):
irc.error(msg, 'No dunnos with %r found.' % text) irc.error(msg, 'No dunnos with %r found.' % text)
return return
ids = [str(t[0]) for t in cursor.fetchall()] ids = [str(t[0]) for t in cursor.fetchall()]
s = 'Dunno search for %r (%d found): %s' % \ s = 'Dunno search for %r (%s found): %s' % \
(text, len(ids), utils.commaAndify(ids)) (text, len(ids), utils.commaAndify(ids))
irc.reply(msg, s) irc.reply(msg, s)
@ -175,10 +173,10 @@ class Dunno(callbacks.Privmsg):
cursor = self.db.cursor() cursor = self.db.cursor()
cursor.execute("""SELECT dunno FROM dunnos WHERE id = %s""", id) cursor.execute("""SELECT dunno FROM dunnos WHERE id = %s""", id)
if cursor.rowcount == 0: if cursor.rowcount == 0:
irc.error(msg, 'No dunno found with id #%d' % id) irc.error(msg, 'No dunno found with id #%s' % id)
return return
dunno = cursor.fetchone()[0] dunno = cursor.fetchone()[0]
irc.reply(msg, "Dunno #%d: %r" % (id, dunno)) irc.reply(msg, "Dunno #%s: %r" % (id, dunno))
Class = Dunno Class = Dunno

View File

@ -489,7 +489,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
irc.reply(msg, "No factoids by %r found." % author) irc.reply(msg, "No factoids by %r found." % author)
return return
keys = [repr(tup[0]) for tup in cursor.fetchall()] keys = [repr(tup[0]) for tup in cursor.fetchall()]
s = "Author search for %r (%d found): %s" % \ s = "Author search for %r (%s found): %s" % \
(author, len(keys), utils.commaAndify(keys)) (author, len(keys), utils.commaAndify(keys))
irc.reply(msg, s) irc.reply(msg, s)
@ -509,7 +509,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
irc.reply(msg, "No keys matching %r found." % search) irc.reply(msg, "No keys matching %r found." % search)
return return
keys = [repr(tup[0]) for tup in cursor.fetchall()] keys = [repr(tup[0]) for tup in cursor.fetchall()]
s = "Key search for %r (%d found): %s" % \ s = "Key search for %r (%s found): %s" % \
(search, len(keys), utils.commaAndify(keys)) (search, len(keys), utils.commaAndify(keys))
irc.reply(msg, s) irc.reply(msg, s)
@ -529,7 +529,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
irc.reply(msg, "No values matching %r found." % search) irc.reply(msg, "No values matching %r found." % search)
return return
keys = [repr(tup[0]) for tup in cursor.fetchall()] keys = [repr(tup[0]) for tup in cursor.fetchall()]
s = "Value search for %r (%d found): %s" % \ s = "Value search for %r (%s found): %s" % \
(search, len(keys), utils.commaAndify(keys)) (search, len(keys), utils.commaAndify(keys))
irc.reply(msg, s) irc.reply(msg, s)

View File

@ -286,11 +286,11 @@ class Todo(callbacks.Privmsg):
cursor.execute("""SELECT userid, priority FROM todo cursor.execute("""SELECT userid, priority FROM todo
WHERE id = %s AND active = 1""", id) WHERE id = %s AND active = 1""", id)
if cursor.rowcount == 0: if cursor.rowcount == 0:
irc.error(msg, 'No note with id %d' % id) irc.error(msg, 'No note with id %s' % id)
return return
(userid, oldpriority) = cursor.fetchone() (userid, oldpriority) = cursor.fetchone()
if userid != user_id: if userid != user_id:
irc.error(msg, 'Todo #%d does not belong to you.' % id) irc.error(msg, 'Todo #%s does not belong to you.' % id)
return return
# If we make it here, we're okay # If we make it here, we're okay
cursor.execute("""UPDATE todo SET priority = %s cursor.execute("""UPDATE todo SET priority = %s