mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
_getId needs the irc object if it's going to use it
This commit is contained in:
parent
41117c431e
commit
75dc3e804a
@ -99,7 +99,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
except KeyError:
|
||||
return 'an unknown user'
|
||||
|
||||
def _getId(self, idStr):
|
||||
def _getId(self, irc, idStr):
|
||||
try:
|
||||
return int(idStr)
|
||||
except ValueError:
|
||||
@ -166,7 +166,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
id = privmsgs.getArgs(args)
|
||||
id = self._getId(id)
|
||||
id = self._getId(irc, id)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
# Check to make sure that the poll exists
|
||||
@ -186,7 +186,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
(poll_id, option) = privmsgs.getArgs(args, required=2)
|
||||
poll_id = self._getId(poll_id)
|
||||
poll_id = self._getId(irc, poll_id)
|
||||
userId = self._getUserId(msg.prefix)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -228,8 +228,8 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
(poll_id, option_id) = privmsgs.getArgs(args, required=2)
|
||||
poll_id = self._getId(poll_id)
|
||||
option_id = self._getId(option_id)
|
||||
poll_id = self._getId(irc, poll_id)
|
||||
option_id = self._getId(irc, option_id)
|
||||
userId = self._getUserId(msg.prefix)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
@ -269,7 +269,7 @@ class Poll(callbacks.Privmsg, plugins.ChannelDBHandler):
|
||||
"""
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
poll_id = privmsgs.getArgs(args)
|
||||
poll_id = self._getId(poll_id)
|
||||
poll_id = self._getId(irc, poll_id)
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""SELECT id, question, started_by, open
|
||||
|
@ -104,4 +104,16 @@ if sqlite is not None:
|
||||
self.assertNotError('poll open Foo 2?')
|
||||
self.assertRegexp('poll list', '#1: \'Foo\?\'.*#2: \'Foo 2\?\'')
|
||||
|
||||
def testGetIDError(self):
|
||||
self.assertNotError('poll open Foo?')
|
||||
self.assertError('poll add a moo')
|
||||
self.assertNotError('poll add 1 moo')
|
||||
self.assertError('poll vote a 1')
|
||||
self.assertError('poll vote 1 a')
|
||||
self.assertNotError('poll vote 1 1')
|
||||
self.assertError('poll results a')
|
||||
self.assertNotError('poll results 1')
|
||||
self.assertError('poll close a')
|
||||
self.assertNotError('poll close 1')
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user