mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
setdefault -> defaultproject
defaultproject without a project name clears the default project cleanup bugs and rfes a little (although they aren't working in the case of 'bugs #'. must use 'bugs project #')
This commit is contained in:
parent
72e554350b
commit
526c4c3e56
@ -72,7 +72,7 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
if yn('Do you want to specify a default project?') == 'y':
|
if yn('Do you want to specify a default project?') == 'y':
|
||||||
project = anything('Project name:')
|
project = anything('Project name:')
|
||||||
if project:
|
if project:
|
||||||
onStart.append('Sourceforge setdefault %s' % project)
|
onStart.append('Sourceforge defaultproject %s' % project)
|
||||||
|
|
||||||
example = utils.wrapLines("""
|
example = utils.wrapLines("""
|
||||||
<@jamessan|work> @bugs
|
<@jamessan|work> @bugs
|
||||||
@ -133,15 +133,16 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Toggleable):
|
|||||||
matches.append((item[0], utils.htmlToText(item[2])))
|
matches.append((item[0], utils.htmlToText(item[2])))
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
def setdefault(self, irc, msg, args):
|
def defaultproject(self, irc, msg, args):
|
||||||
"""<project>
|
"""[<project>]
|
||||||
|
|
||||||
Sets the default project to be used with bugs and rfes
|
Sets the default project to be used with bugs and rfes. If a project
|
||||||
|
is not specified, clears the default project.
|
||||||
"""
|
"""
|
||||||
project = privmsgs.getArgs(args)
|
project = privmsgs.getArgs(args, needed=0, optional=1)
|
||||||
self.project = project
|
self.project = project
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
setdefault = privmsgs.checkCapability(setdefault, 'admin')
|
defaultproject = privmsgs.checkCapability(defaultproject, 'admin')
|
||||||
|
|
||||||
def _getTrackerInfo(self, irc, msg, url, regex, num):
|
def _getTrackerInfo(self, irc, msg, url, regex, num):
|
||||||
try:
|
try:
|
||||||
@ -167,7 +168,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Toggleable):
|
|||||||
text = fd.read()
|
text = fd.read()
|
||||||
fd.close()
|
fd.close()
|
||||||
resp = []
|
resp = []
|
||||||
if num != '':
|
if num:
|
||||||
head = '%s <http://sourceforge.net%s>'
|
head = '%s <http://sourceforge.net%s>'
|
||||||
for match in self._formatResp(num, text):
|
for match in self._formatResp(num, text):
|
||||||
resp.append(head % match)
|
resp.append(head % match)
|
||||||
@ -183,7 +184,8 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Toggleable):
|
|||||||
resp = map(lambda s: utils.ellipsisify(s, 50), resp)
|
resp = map(lambda s: utils.ellipsisify(s, 50), resp)
|
||||||
irc.reply(msg, '%s' % utils.commaAndify(resp))
|
irc.reply(msg, '%s' % utils.commaAndify(resp))
|
||||||
return
|
return
|
||||||
irc.reply(msg, 'No Trackers were found.')
|
irc.error(msg, 'No Trackers were found. (%s)' %
|
||||||
|
conf.replyPossibleBug)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
irc.error(msg, str(e))
|
irc.error(msg, str(e))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
@ -191,18 +193,16 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Toggleable):
|
|||||||
|
|
||||||
_bugLink = re.compile(r'"([^"]+)">Bugs')
|
_bugLink = re.compile(r'"([^"]+)">Bugs')
|
||||||
def bugs(self, irc, msg, args):
|
def bugs(self, irc, msg, args):
|
||||||
"""[<project> [<num>]]
|
"""[<project>] [<num>]
|
||||||
|
|
||||||
Returns a list of the most recent bugs filed against <project>.
|
Returns a list of the most recent bugs filed against <project>.
|
||||||
Defaults to searching for supybot bugs. If <num> is specified, the bug
|
Defaults to searching for bugs in the project set by defaultproject.
|
||||||
description and link are retrieved.
|
If <num> is specified, the bug description and link are retrieved.
|
||||||
"""
|
"""
|
||||||
(project, bugnum) = privmsgs.getArgs(args, needed=0, optional=2)
|
(project, bugnum) = privmsgs.getArgs(args, needed=0, optional=2)
|
||||||
|
project = project or self.project
|
||||||
if not project:
|
if not project:
|
||||||
if self.project is None:
|
raise callbacks.ArgumentError
|
||||||
raise callbacks.ArgumentError
|
|
||||||
else:
|
|
||||||
project = self.project
|
|
||||||
elif not bugnum:
|
elif not bugnum:
|
||||||
try:
|
try:
|
||||||
bugnum = int(project)
|
bugnum = int(project)
|
||||||
@ -214,18 +214,16 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, plugins.Toggleable):
|
|||||||
|
|
||||||
_rfeLink = re.compile(r'"([^"]+)">RFE')
|
_rfeLink = re.compile(r'"([^"]+)">RFE')
|
||||||
def rfes(self, irc, msg, args):
|
def rfes(self, irc, msg, args):
|
||||||
"""[<project> [<num>]]
|
"""[<project>] [<num>]
|
||||||
|
|
||||||
Returns a list of the most recent RFEs filed against <project>.
|
Returns a list of the most recent RFEs filed against <project>.
|
||||||
Defaults to searching for supybot RFEs. If <num> is specified, the rfe
|
Defaults to searching for RFEs in the project set by defaultproject.
|
||||||
description and link are retrieved.
|
If <num> is specified, the rfe description and link are retrieved.
|
||||||
"""
|
"""
|
||||||
(project, rfenum) = privmsgs.getArgs(args, needed=0, optional=2)
|
(project, rfenum) = privmsgs.getArgs(args, needed=0, optional=2)
|
||||||
|
project = project or self.project
|
||||||
if not project:
|
if not project:
|
||||||
if self.project is None:
|
raise callbacks.ArgumentError
|
||||||
raise callbacks.ArgumentError
|
|
||||||
else:
|
|
||||||
project = self.project
|
|
||||||
elif not rfenum:
|
elif not rfenum:
|
||||||
try:
|
try:
|
||||||
rfenum = int(project)
|
rfenum = int(project)
|
||||||
|
@ -53,9 +53,13 @@ class SourceforgeTest(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
n = re.search('#(\d+)', m.args[1]).group(1)
|
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||||
self.assertNotError('rfes gaim %s' % n)
|
self.assertNotError('rfes gaim %s' % n)
|
||||||
|
|
||||||
def testSetdefault(self):
|
def testDefaultproject(self):
|
||||||
self.assertNotError('setdefault supybot')
|
self.assertHelp('bugs')
|
||||||
self.assertNotError('rfes')
|
self.assertNotError('defaultproject supybot')
|
||||||
|
self.assertNotError('bugs')
|
||||||
|
m = self.getMsg('bugs')
|
||||||
|
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||||
|
self.assertNotError('bugs %s' % n)
|
||||||
|
|
||||||
def testSnarfer(self):
|
def testSnarfer(self):
|
||||||
s = r'.*Status.*: \w+'
|
s = r'.*Status.*: \w+'
|
||||||
|
Loading…
Reference in New Issue
Block a user