mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
enableSpecificTrackerCommands.
This commit is contained in:
parent
db4ae67a58
commit
0ceb2deb80
@ -98,6 +98,10 @@ conf.registerChannelValue(conf.supybot.plugins.Sourceforge, 'defaultProject',
|
|||||||
explicit project is given."""))
|
explicit project is given."""))
|
||||||
conf.registerGlobalValue(conf.supybot.plugins.Sourceforge, 'bold',
|
conf.registerGlobalValue(conf.supybot.plugins.Sourceforge, 'bold',
|
||||||
registry.Boolean(True, """Determines whether the results are bolded."""))
|
registry.Boolean(True, """Determines whether the results are bolded."""))
|
||||||
|
conf.registerGlobalValue(conf.supybot.plugins.Sourceforge,
|
||||||
|
'enableSpecificTrackerCommands', registry.Boolean(True, """Determines
|
||||||
|
whether the bug, rfe, and patch commands (convenience wrappers around
|
||||||
|
the tracker command) will be enabled."""))
|
||||||
|
|
||||||
class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||||
"""
|
"""
|
||||||
@ -130,6 +134,12 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
super(Sourceforge, self).__init__()
|
super(Sourceforge, self).__init__()
|
||||||
self.__class__.sf = self.__class__.sourceforge
|
self.__class__.sf = self.__class__.sourceforge
|
||||||
|
|
||||||
|
def isCommand(self, name):
|
||||||
|
if name in ('bug', 'rfe', 'patch'):
|
||||||
|
return self.registryValue('enableSpecificTrackerCommands')
|
||||||
|
else:
|
||||||
|
return super(Sourceforge, self).isCommand(name)
|
||||||
|
|
||||||
def _formatResp(self, text, num=''):
|
def _formatResp(self, text, num=''):
|
||||||
"""
|
"""
|
||||||
Parses the Sourceforge query to return a list of tuples that
|
Parses the Sourceforge query to return a list of tuples that
|
||||||
@ -221,11 +231,38 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
except webutils.WebError, e:
|
except webutils.WebError, e:
|
||||||
raise TrackerError, str(e)
|
raise TrackerError, str(e)
|
||||||
|
|
||||||
def tracker(self, irc, msg, args):
|
def bug(self, irc, msg, args):
|
||||||
"""<num>
|
"""<id>
|
||||||
|
|
||||||
Returns a description of the tracker with Tracker id <num> and the
|
Returns a description of the bug with id <id>. Really, this is
|
||||||
corresponding Tracker url.
|
just a wrapper for the tracker command; it won't even complain if the
|
||||||
|
<id> you give isn't a bug.
|
||||||
|
"""
|
||||||
|
self.tracker(irc, msg, args)
|
||||||
|
|
||||||
|
def patch(self, irc, msg, args):
|
||||||
|
"""<id>
|
||||||
|
|
||||||
|
Returns a description of the patch with id <id>. Really, this is
|
||||||
|
just a wrapper for the tracker command; it won't even complain if the
|
||||||
|
<id> you give isn't a patch.
|
||||||
|
"""
|
||||||
|
self.tracker(irc, msg, args)
|
||||||
|
|
||||||
|
def rfe(self, irc, msg, args):
|
||||||
|
"""<id>
|
||||||
|
|
||||||
|
Returns a description of the rfe with id <id>. Really, this is
|
||||||
|
just a wrapper for the tracker command; it won't even complain if the
|
||||||
|
<id> you give isn't an rfe.
|
||||||
|
"""
|
||||||
|
self.tracker(irc, msg, args)
|
||||||
|
|
||||||
|
def tracker(self, irc, msg, args):
|
||||||
|
"""<id>
|
||||||
|
|
||||||
|
Returns a description of the tracker with id <id> and the corresponding
|
||||||
|
url.
|
||||||
"""
|
"""
|
||||||
num = privmsgs.getArgs(args)
|
num = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
|
@ -39,6 +39,19 @@ Sf = conf.supybot.plugins.Sourceforge
|
|||||||
class SourceforgeTest(ChannelPluginTestCase):
|
class SourceforgeTest(ChannelPluginTestCase):
|
||||||
plugins = ('Sourceforge',)
|
plugins = ('Sourceforge',)
|
||||||
config = {'supybot.plugins.Sourceforge.bold': False}
|
config = {'supybot.plugins.Sourceforge.bold': False}
|
||||||
|
def testEnableSpecificTrackerCommands(self):
|
||||||
|
w = conf.supybot.plugins.Sourceforge.enableSpecificTrackerCommands
|
||||||
|
orig = w()
|
||||||
|
try:
|
||||||
|
w.setValue(True)
|
||||||
|
self.assertRegexp('list Sourceforge',
|
||||||
|
r'bug[^s].*patch[^es].*rfe[^s]')
|
||||||
|
w.setValue(False)
|
||||||
|
self.assertNotRegexp('list Sourceforge',
|
||||||
|
r'bug[^s].*patch[^es].*rfe[^s]')
|
||||||
|
finally:
|
||||||
|
w.setValue(orig)
|
||||||
|
|
||||||
if network:
|
if network:
|
||||||
def testAny(self):
|
def testAny(self):
|
||||||
m = self.getMsg('bugs --any gaim')
|
m = self.getMsg('bugs --any gaim')
|
||||||
|
Loading…
Reference in New Issue
Block a user