Changed some asserts to raise ValueError instead.

This commit is contained in:
Jeremy Fincher 2003-09-06 18:32:10 +00:00
parent 63403e6408
commit 5296d51dc2

View File

@ -43,7 +43,8 @@ import world
import ircutils import ircutils
def fromChannelCapability(capability): def fromChannelCapability(capability):
assert isChannelCapability(capability) if not isChannelCapability(capability):
raise ValueError, '%s is not a channel capability' % capability
return capability.split('.', 1) return capability.split('.', 1)
def isChannelCapability(capability): def isChannelCapability(capability):
@ -69,7 +70,8 @@ def makeAntiCapability(capability):
return '!' + capability return '!' + capability
def unAntiCapability(capability): def unAntiCapability(capability):
assert isAntiCapability(capability) if not isAntiCapability(capability):
raise ValueError, '%s is not an anti capability' % capability
if isChannelCapability(capability): if isChannelCapability(capability):
(channel, capability) = fromChannelCapability(capability) (channel, capability) = fromChannelCapability(capability)
return '.'.join((channel, capability[1:])) return '.'.join((channel, capability[1:]))