Some kind of little cleanup. There was a pluralize call that used the wrong order for its arguments.

This commit is contained in:
Jeremy Fincher 2003-12-17 13:14:33 +00:00
parent a3edca49a0
commit 751090a556
2 changed files with 14 additions and 14 deletions

View File

@ -215,7 +215,8 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
def urlquery2bugslist(self, url, query):
"""Given a URL and query list for a CSV bug list, it'll return
all the bugs in a dict """
all the bugs in a dict
"""
u = urllib2.urlopen(url + '/buglist.cgi', string.join(query, '&'))
# actually read in the file
csvreader = csv.reader(u)
@ -233,7 +234,6 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
for f in fields[1:]:
bugs[bugid][f] = bug[i]
i += 1
u.close()
return bugs
@ -264,15 +264,10 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
bugs = self.urlquery2bugslist(url, query)
bugids = bugs.keys()
bugids.sort()
outputstr = '%d %s match \'%s\' (%s):' % (len(bugs), \
utils.pluralize(len(bugs), 'bug'),
searchstr, utils.commaAndify(keywords, And='AND'))
for b in bugids:
outputstr += ' %s' % (str(b))
irc.reply(msg, outputstr)
s = '%s match %r (%s): %s.' % \
(utils.nItems('bug', len(bugs)), searchstr,
' AND '.join(keywords), utils.commaAndify(map(str, bugids)))
irc.reply(msg, s)
def bug(self, irc, msg, args):
"""<abbreviation> <number>

View File

@ -33,13 +33,18 @@ from testsupport import *
class BugzillaTest(PluginTestCase, PluginDocumentation):
plugins = ('Bugzilla',)
def test(self):
def testBug(self):
self.assertNotError('bug gcc 5')
self.assertNotError('search --keywords=fixed gcc alpha')
self.assertNotError('search gcc alpha')
def testAddRemove(self):
self.assertNotError('add xiph http://bugs.xiph.org/ Xiph')
self.assertNotError('bug xiph 413')
self.assertNotError('remove xiph')
self.assertError('bug xiph 413')
def testSearch(self):
self.assertNotError('search gcc alpha')
self.assertNotError('search --keywords=fixed gcc alpha')
def testConfigBugzillaSnarfer(self):
self.assertNotError('bugzilla config bug-snarfer off')