Fixed enable and disable not to allow ValueError through their makeAntiCapability calls.

This commit is contained in:
Jeremy Fincher 2003-09-06 18:37:22 +00:00
parent 5296d51dc2
commit 2266faec5f

View File

@ -98,9 +98,13 @@ class AdminCommands(privmsgs.CapabilityCheckingPrivmsg):
else: else:
# This has to know that defaultCapabilties gets turned into a # This has to know that defaultCapabilties gets turned into a
# dictionary. # dictionary.
try:
capability = ircdb.makeAntiCapability(command)
except ValueError:
irc.error(msg, '%r is not a valid command.' % command)
return
if command in conf.defaultCapabilities: if command in conf.defaultCapabilities:
conf.defaultCapabilities.remove(command) conf.defaultCapabilities.remove(command)
capability = ircdb.makeAntiCapability(command)
conf.defaultCapabilities.add(capability) conf.defaultCapabilities.add(capability)
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
@ -110,7 +114,11 @@ class AdminCommands(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)
anticapability = ircdb.makeAntiCapability(command) try:
anticapability = ircdb.makeAntiCapability(command)
except ValueError:
irc.error(msg, '%r is not a valid command.' % command)
return
if anticapability in conf.defaultCapabilities: if anticapability in conf.defaultCapabilities:
conf.defaultCapabilities.remove(anticapability) conf.defaultCapabilities.remove(anticapability)
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)