Changed the name of getCommand to getCommandMethod in preparation for a major refactoring.

This commit is contained in:
Jeremy Fincher 2005-02-15 06:53:30 +00:00
parent c09a7cace1
commit 99d723802e
2 changed files with 11 additions and 11 deletions

View File

@ -88,7 +88,7 @@ class RSS(callbacks.Plugin):
commandName = callbacks.canonicalName(name) commandName = callbacks.canonicalName(name)
if self.isCommand(commandName): if self.isCommand(commandName):
name = commandName name = commandName
url = self.getCommand(name).url url = self.getCommandMethod(name).url
else: else:
url = name url = name
if self.willGetNewFeed(url): if self.willGetNewFeed(url):

View File

@ -632,7 +632,7 @@ class IrcObjectProxy(RichReplyMethods):
def _callCommand(self, name, cb): def _callCommand(self, name, cb):
try: try:
self.commandMethod = cb.getCommand(name) self.commandMethod = cb.getCommandMethod(name)
if not world.isMainThread(): if not world.isMainThread():
# If we're a threaded command, we may not reply quickly enough # If we're a threaded command, we may not reply quickly enough
# to prevent regexp stuff from running. So we do this to make # to prevent regexp stuff from running. So we do this to make
@ -914,7 +914,7 @@ class CommandThread(world.SupyThread):
def __init__(self, target=None, args=(), kwargs={}): def __init__(self, target=None, args=(), kwargs={}):
(self.name, self.cb) = args (self.name, self.cb) = args
self.__parent = super(CommandThread, self) self.__parent = super(CommandThread, self)
self.command = self.cb.getCommand(self.name) self.command = self.cb.getCommandMethod(self.name)
threadName = 'Thread #%s (for %s.%s)' % (world.threadsSpawned, threadName = 'Thread #%s (for %s.%s)' % (world.threadsSpawned,
self.cb.name(), self.name) self.cb.name(), self.name)
log.debug('Spawning thread %s' % threadName) log.debug('Spawning thread %s' % threadName)
@ -1025,10 +1025,10 @@ class Commands(object):
else: else:
return False return False
def getCommand(self, name): def getCommandMethod(self, name):
"""Gets the given command from this plugin.""" """Gets the given command from this plugin."""
name = canonicalName(name) name = canonicalName(name)
assert self.isCommand(name), format('%s is not a command.', name) assert self.isCommand(name), format('%q is not a command.', name)
return getattr(self, name) return getattr(self, name)
def listCommands(self): def listCommands(self):
@ -1051,7 +1051,7 @@ class Commands(object):
if cap: if cap:
irc.errorNoCapability(cap) irc.errorNoCapability(cap)
return return
method = self.getCommand(name) method = self.getCommandMethod(name)
assert L, 'Odd, nothing in L. This can\'t happen.' assert L, 'Odd, nothing in L. This can\'t happen.'
self.log.info('%s.%s called by %s.', self.name(), name, msg.prefix) self.log.info('%s.%s called by %s.', self.name(), name, msg.prefix)
self.log.debug('args: %s', L[0]) self.log.debug('args: %s', L[0])
@ -1069,9 +1069,9 @@ class Commands(object):
name = canonicalName(name) name = canonicalName(name)
assert self.isCommand(name), \ assert self.isCommand(name), \
'%s is not a command in %s.' % (name, self.name()) '%s is not a command in %s.' % (name, self.name())
command = self.getCommand(name) method = self.getCommandMethod(name)
if hasattr(command, 'isDispatcher') and \ if hasattr(method, 'isDispatcher') and \
command.isDispatcher and self.__doc__: method.isDispatcher and self.__doc__:
return utils.str.normalizeWhitespace(self.__doc__) return utils.str.normalizeWhitespace(self.__doc__)
elif hasattr(command, '__doc__'): elif hasattr(command, '__doc__'):
return getHelp(command) return getHelp(command)
@ -1277,11 +1277,11 @@ class PluginRegexp(Plugin):
name in self.regexps or \ name in self.regexps or \
name in self.addressedRegexps name in self.addressedRegexps
def getCommand(self, name): def getCommandMethod(self, name):
try: try:
return getattr(self, name) # Regexp stuff. return getattr(self, name) # Regexp stuff.
except AttributeError: except AttributeError:
return self.__parent.getCommand(name) return self.__parent.getCommandMethod(name)
def callCommand(self, name, irc, msg, *L, **kwargs): def callCommand(self, name, irc, msg, *L, **kwargs):
try: try: