Handled the case where one factoid is returned from Factoids.search better.

This commit is contained in:
Jeremy Fincher 2003-11-18 17:49:10 +00:00
parent 8a2e50baf1
commit 23db0b7aaa
2 changed files with 4 additions and 0 deletions

View File

@ -396,6 +396,8 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
cursor.execute(sql, formats)
if cursor.rowcount == 0:
irc.reply(msg, 'No keys matched that query.')
elif cursor.rowcount == 1:
self.whatis(irc, msg, [cursor.fetchone()[0]])
elif cursor.rowcount > 100:
irc.reply(msg, 'More than 100 keys matched that query; '
'please narrow your query.')

View File

@ -102,6 +102,8 @@ if sqlite is not None:
'inkedmn.*strike|strike.*inkedmn')
self.assertRegexp('search ke',
'inkedmn.*strike|strike.*inkedmn')
self.assertRegexp('search jemfinch',
'my primary author')
def testNotZeroIndexed(self):