From 72f93610b1217ecca4aff3585e768b895af0643a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 29 Nov 2003 18:45:29 +0000 Subject: [PATCH] Fix for bug #851254. --- ChangeLog | 2 ++ plugins/Factoids.py | 2 +- test/test_Factoids.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 183caf94b..de9da043b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ + * Fixed bug #851254, Factoids.whatis didn't work on numeric keys. + * Added the ability to turn on/off the showing of ids in FunDB excuse/insult/praise/lart. diff --git a/plugins/Factoids.py b/plugins/Factoids.py index 2172229ee..369816f3c 100644 --- a/plugins/Factoids.py +++ b/plugins/Factoids.py @@ -131,7 +131,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg): necessary if the message isn't sent in the channel itself. """ channel = privmsgs.getChannel(msg, args) - if args[-1].isdigit(): + if len(args) > 1 and args[-1].isdigit(): number = args.pop() else: number = '' diff --git a/test/test_Factoids.py b/test/test_Factoids.py index c312ace4c..967b29c6a 100644 --- a/test/test_Factoids.py +++ b/test/test_Factoids.py @@ -105,6 +105,9 @@ if sqlite is not None: self.assertRegexp('search jemfinch', 'my primary author') + def testWhatisOnNumbers(self): + self.assertNotError('learn 911 as emergency number') + self.assertRegexp('whatis 911', 'emergency number') def testNotZeroIndexed(self): self.assertNotError('learn foo as bar')