Throw error when extraArgs is not a list

This commit is contained in:
rdb 2009-02-24 06:07:55 +00:00
parent 0f634524be
commit 6786954cf8

View File

@ -119,11 +119,15 @@ class Messenger:
"object: %s\n accepting: %s\n method: %s\n extraArgs: %s\n persistent: %s" %
(object, event, method, extraArgs, persistent))
# Make the the method is callable
# Make sure that the method is callable
assert callable(method), (
"method not callable in accept (ignoring): %s %s"%
(method, extraArgs))
# Make sure extraArgs is a list or tuple
if not (isinstance(extraArgs, list) or isinstance(extraArgs, tuple) or isinstance(extraArgs, set)):
raise TypeError, "A list is required as extraArgs argument"
self.lock.acquire()
try:
acceptorDict = self.__callbacks.setdefault(event, {})