Made CommandThread work with non-instancemethods.

This commit is contained in:
Jeremy Fincher 2003-08-25 19:50:46 +00:00
parent e30cf69ec1
commit 5630782e85

View File

@ -342,8 +342,14 @@ class CommandThread(threading.Thread):
def __init__(self, command, irc, msg, args): def __init__(self, command, irc, msg, args):
self.command = command self.command = command
world.threadsSpawned += 1 world.threadsSpawned += 1
try:
self.commandName = command.im_func.func_name self.commandName = command.im_func.func_name
except AttributeError:
self.commandName = command.__name__
try:
self.className = command.im_class.__name__ self.className = command.im_class.__name__
except AttributeError:
self.className = '<unknown>'
name = '%s.%s with args %r' % (self.className, self.commandName, args) name = '%s.%s with args %r' % (self.className, self.commandName, args)
threading.Thread.__init__(self, target=command, name=name, threading.Thread.__init__(self, target=command, name=name,
args=(irc, msg, args)) args=(irc, msg, args))