mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Fixed escaping KeyError and added test.
This commit is contained in:
parent
2719812074
commit
e386518997
@ -276,8 +276,8 @@ class ChannelDB(callbacks.PrivmsgCommandAndRegexp, ChannelDBHandler):
|
|||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
name = privmsgs.getArgs(args)
|
name = privmsgs.getArgs(args)
|
||||||
if not ircdb.users.hasUser(name):
|
if not ircdb.users.hasUser(name):
|
||||||
hostmask = irc.state.nickToHostmask(name)
|
|
||||||
try:
|
try:
|
||||||
|
hostmask = irc.state.nickToHostmask(name)
|
||||||
name = ircdb.users.getUserName(hostmask)
|
name = ircdb.users.getUserName(hostmask)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
|
@ -38,6 +38,10 @@ class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertNotError('channelstats')
|
self.assertNotError('channelstats')
|
||||||
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:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user