Make the error messages refer to specific tracker types instead of using

the generic term tracker.
This commit is contained in:
James Vega 2004-12-12 20:02:42 +00:00
parent 730c0ffd95
commit aa3868c87e

View File

@ -175,22 +175,22 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
except webutils.WebError, e: except webutils.WebError, e:
raise callbacks.Error, str(e) raise callbacks.Error, str(e)
def _getTrackerList(self, url): def _getTrackerList(self, url, type):
""" """
Searches the tracker list page and returns a list of the trackers. Searches the tracker list page and returns a list of the trackers.
""" """
try: try:
text = webutils.getUrl(url) text = webutils.getUrl(url)
if "No matches found." in text: if "No matches found." in text:
return 'No trackers were found.' return 'No %s were found.' % type
head = '#%s: %s' head = '#%s: %s'
resp = [head % entry for entry in self._formatResp(text)] resp = [head % entry for entry in self._formatResp(text)]
if resp: if resp:
if len(resp) > 10: if len(resp) > 10:
resp = imap(lambda s: utils.ellipsisify(s, 50), resp) resp = imap(lambda s: utils.ellipsisify(s, 50), resp)
return '%s' % utils.commaAndify(resp) return '%s' % utils.commaAndify(resp)
raise callbacks.Error, 'No Trackers were found. (%s)' % \ raise callbacks.Error, 'No %s were found. (%s)' % \
conf.supybot.replies.possibleBug() (type, conf.supybot.replies.possibleBug())
except webutils.WebError, e: except webutils.WebError, e:
raise callbacks.Error, str(e) raise callbacks.Error, str(e)
@ -288,8 +288,8 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
status = option status = option
try: try:
int(project) int(project)
s = 'Use the tracker command to get information about a specific '\ s = 'Use the tracker command to get information about specific '\
'tracker.' '%s.' % tracker
irc.error(s) irc.error(s)
return return
except ValueError: except ValueError:
@ -305,7 +305,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
irc.error('%s. I can\'t find the %s link.' % irc.error('%s. I can\'t find the %s link.' %
(e, tracker.capitalize())) (e, tracker.capitalize()))
return return
irc.reply(self._getTrackerList(url)) irc.reply(self._getTrackerList(url, tracker))
def bugs(self, irc, msg, args, optlist, project): def bugs(self, irc, msg, args, optlist, project):
"""[--{any,open,closed,deleted,pending}] [<project>] """[--{any,open,closed,deleted,pending}] [<project>]