checking that the method passed in is callable

This commit is contained in:
Dave Schuyler 2005-06-28 03:02:29 +00:00
parent 8013700245
commit 5351d31c64
1 changed files with 11 additions and 1 deletions

View File

@ -54,6 +54,11 @@ class Messenger:
+ '\n method: ' + `method`
+ '\n extraArgs: ' + `extraArgs`
+ '\n persistent: ' + `persistent`)
if not callable(method):
self.notify.warning(
"method not callable in accept (ignoring): %s %s"%
(method, extraArgs))
return
acceptorDict = self.__callbacks.setdefault(event, {})
acceptorDict[object] = [method, extraArgs, persistent]
@ -195,7 +200,12 @@ class Messenger:
# we have cleaned up the accept hook, because the
# method itself might call accept() or acceptOnce()
# again.
apply(method, (extraArgs + sentArgs))
if callable(method):
apply(method, (extraArgs + sentArgs))
else:
self.notify.warning(
"method not callable in send: %s %s %s"%
(method, extraArgs, sentArgs))
def clear(self):
"""