Fixed escaping KeyError and added test.

This commit is contained in:
Jeremy Fincher 2003-09-09 07:57:49 +00:00
parent 2719812074
commit e386518997
2 changed files with 5 additions and 1 deletions

View File

@ -276,8 +276,8 @@ class ChannelDB(callbacks.PrivmsgCommandAndRegexp, ChannelDBHandler):
channel = privmsgs.getChannel(msg, args)
name = privmsgs.getArgs(args)
if not ircdb.users.hasUser(name):
hostmask = irc.state.nickToHostmask(name)
try:
hostmask = irc.state.nickToHostmask(name)
name = ircdb.users.getUserName(hostmask)
except KeyError:
irc.error(msg, conf.replyNoUser)

View File

@ -38,6 +38,10 @@ class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('channelstats')
self.assertNotError('channelstats')
def testNoKeyErrorEscapeFromSeen(self):
self.assertRegexp('seen asldfkjasdlfkj', conf.replyNoUser)
self.assertNotRegexp('seen asldfkjasdlfkj', 'KeyError')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: