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
1 changed files with 10 additions and 2 deletions

View File

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