mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +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.
|
Re-enables the command <command> for all non-owner users.
|
||||||
"""
|
"""
|
||||||
command = privmsgs.getArgs(args)
|
command = privmsgs.getArgs(args)
|
||||||
try:
|
command = command.lower()
|
||||||
anticapability = ircdb.makeAntiCapability(command)
|
L = []
|
||||||
except ValueError:
|
for capability in conf.supybot.defaultCapabilities():
|
||||||
irc.error('%r is not a valid command.' % command)
|
if ircdb.isAntiCapability(capability):
|
||||||
return
|
nonAntiCapability = ircdb.unAntiCapability(capability)
|
||||||
if anticapability in conf.supybot.defaultCapabilities():
|
if nonAntiCapability.lower() == command:
|
||||||
conf.supybot.defaultCapabilities().remove(anticapability)
|
L.append(capability)
|
||||||
|
if L:
|
||||||
|
for capability in L:
|
||||||
|
conf.supybot.defaultCapabilities().remove(capability)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
else:
|
else:
|
||||||
irc.error('That command wasn\'t disabled.')
|
irc.error('That command wasn\'t disabled.')
|
||||||
|
@ -75,6 +75,10 @@ class AdminTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
def testEnable(self):
|
def testEnable(self):
|
||||||
self.assertError('enable enable')
|
self.assertError('enable enable')
|
||||||
|
|
||||||
|
def testEnableIsCaseInsensitive(self):
|
||||||
|
self.assertNotError('disable Foo')
|
||||||
|
self.assertNotError('enable foo')
|
||||||
|
|
||||||
def testJoin(self):
|
def testJoin(self):
|
||||||
m = self.getMsg('join #foo')
|
m = self.getMsg('join #foo')
|
||||||
self.assertEqual(m.command, 'JOIN')
|
self.assertEqual(m.command, 'JOIN')
|
||||||
|
Loading…
Reference in New Issue
Block a user