mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Made enable case-insensitive.
This commit is contained in:
parent
72adc73330
commit
da209e5a36
17
src/Admin.py
17
src/Admin.py
@ -226,13 +226,16 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
||||
Re-enables the command <command> for all non-owner users.
|
||||
"""
|
||||
command = privmsgs.getArgs(args)
|
||||
try:
|
||||
anticapability = ircdb.makeAntiCapability(command)
|
||||
except ValueError:
|
||||
irc.error('%r is not a valid command.' % command)
|
||||
return
|
||||
if anticapability in conf.supybot.defaultCapabilities():
|
||||
conf.supybot.defaultCapabilities().remove(anticapability)
|
||||
command = command.lower()
|
||||
L = []
|
||||
for capability in conf.supybot.defaultCapabilities():
|
||||
if ircdb.isAntiCapability(capability):
|
||||
nonAntiCapability = ircdb.unAntiCapability(capability)
|
||||
if nonAntiCapability.lower() == command:
|
||||
L.append(capability)
|
||||
if L:
|
||||
for capability in L:
|
||||
conf.supybot.defaultCapabilities().remove(capability)
|
||||
irc.replySuccess()
|
||||
else:
|
||||
irc.error('That command wasn\'t disabled.')
|
||||
|
@ -75,6 +75,10 @@ class AdminTestCase(PluginTestCase, PluginDocumentation):
|
||||
def testEnable(self):
|
||||
self.assertError('enable enable')
|
||||
|
||||
def testEnableIsCaseInsensitive(self):
|
||||
self.assertNotError('disable Foo')
|
||||
self.assertNotError('enable foo')
|
||||
|
||||
def testJoin(self):
|
||||
m = self.getMsg('join #foo')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
|
Loading…
Reference in New Issue
Block a user