Added a few more asserts and clarified an already existing one.

This commit is contained in:
Jeremy Fincher 2005-08-15 05:36:23 +00:00
parent 3a0d71c15a
commit 27656e5fef
2 changed files with 5 additions and 1 deletions

View File

@ -124,6 +124,8 @@ class Owner(callbacks.Plugin):
# This plugin must be first; its priority must be lowest; otherwise odd
# things will happen when adding callbacks.
def __init__(self, irc=None):
if irc is not None:
assert not irc.getCallback(self.name())
self.__parent = super(Owner, self)
self.__parent.__init__(irc)
# Setup log object/command.
@ -254,7 +256,8 @@ class Owner(callbacks.Plugin):
do422 = do377 = do376
def doPrivmsg(self, irc, msg):
assert self is irc.callbacks[0], 'Owner isn\'t first callback.'
assert self is irc.callbacks[0], \
'Owner isn\'t first callback: %r' % irc.callbacks
if ircmsgs.isCtcp(msg):
return
s = callbacks.addressed(irc.nick, msg)

View File

@ -629,6 +629,7 @@ class Irc(IrcCommandDispatcher):
# This *isn't* threadsafe!
def addCallback(self, callback):
"""Adds a callback to the callbacks list."""
assert not self.getCallback(callback.name())
self.callbacks.append(callback)
# This is the new list we're building, which will be tsorted.
cbs = []