mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Some kind of little cleanup. There was a pluralize call that used the wrong order for its arguments.
This commit is contained in:
parent
a3edca49a0
commit
751090a556
@ -215,7 +215,8 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
|
|||||||
|
|
||||||
def urlquery2bugslist(self, url, query):
|
def urlquery2bugslist(self, url, query):
|
||||||
"""Given a URL and query list for a CSV bug list, it'll return
|
"""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, '&'))
|
u = urllib2.urlopen(url + '/buglist.cgi', string.join(query, '&'))
|
||||||
# actually read in the file
|
# actually read in the file
|
||||||
csvreader = csv.reader(u)
|
csvreader = csv.reader(u)
|
||||||
@ -233,7 +234,6 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
|
|||||||
for f in fields[1:]:
|
for f in fields[1:]:
|
||||||
bugs[bugid][f] = bug[i]
|
bugs[bugid][f] = bug[i]
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
u.close()
|
u.close()
|
||||||
return bugs
|
return bugs
|
||||||
|
|
||||||
@ -264,15 +264,10 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
|
|||||||
bugs = self.urlquery2bugslist(url, query)
|
bugs = self.urlquery2bugslist(url, query)
|
||||||
bugids = bugs.keys()
|
bugids = bugs.keys()
|
||||||
bugids.sort()
|
bugids.sort()
|
||||||
|
s = '%s match %r (%s): %s.' % \
|
||||||
outputstr = '%d %s match \'%s\' (%s):' % (len(bugs), \
|
(utils.nItems('bug', len(bugs)), searchstr,
|
||||||
utils.pluralize(len(bugs), 'bug'),
|
' AND '.join(keywords), utils.commaAndify(map(str, bugids)))
|
||||||
searchstr, utils.commaAndify(keywords, And='AND'))
|
irc.reply(msg, s)
|
||||||
|
|
||||||
for b in bugids:
|
|
||||||
outputstr += ' %s' % (str(b))
|
|
||||||
|
|
||||||
irc.reply(msg, outputstr)
|
|
||||||
|
|
||||||
def bug(self, irc, msg, args):
|
def bug(self, irc, msg, args):
|
||||||
"""<abbreviation> <number>
|
"""<abbreviation> <number>
|
||||||
|
@ -33,13 +33,18 @@ from testsupport import *
|
|||||||
|
|
||||||
class BugzillaTest(PluginTestCase, PluginDocumentation):
|
class BugzillaTest(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('Bugzilla',)
|
plugins = ('Bugzilla',)
|
||||||
def test(self):
|
def testBug(self):
|
||||||
self.assertNotError('bug gcc 5')
|
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('add xiph http://bugs.xiph.org/ Xiph')
|
||||||
self.assertNotError('bug xiph 413')
|
self.assertNotError('bug xiph 413')
|
||||||
self.assertNotError('remove xiph')
|
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):
|
def testConfigBugzillaSnarfer(self):
|
||||||
self.assertNotError('bugzilla config bug-snarfer off')
|
self.assertNotError('bugzilla config bug-snarfer off')
|
||||||
|
Loading…
Reference in New Issue
Block a user