Fixed the nesting bug with testEval and testCalc.

This commit is contained in:
Jeremy Fincher 2003-10-29 23:40:14 +00:00
parent e556e783b1
commit 58cf080109
3 changed files with 5 additions and 3 deletions

View File

@ -52,6 +52,7 @@ import callbacks
class Misc(callbacks.Privmsg):
priority = sys.maxint
def invalidCommand(self, irc, msg, tokens):
#debug.printf('Misc.invalidCommand called')
if conf.replyWhenNotCommand:
command = tokens and tokens[0] or ''
irc.error(msg, '%r is not a valid command.' % command)

View File

@ -340,7 +340,7 @@ def formatArgumentError(method, name=None):
class IrcObjectProxy:
"A proxy object to allow proper nested of commands (even threaded ones)."
def __init__(self, irc, msg, args):
#debug.printf('__init__: %s' % args)
#debug.printf('IrcObjectProxy.__init__: %s' % args)
self.irc = irc
self.msg = msg
self.args = args
@ -370,6 +370,7 @@ class IrcObjectProxy:
def _callInvalidCommands(self):
for cb in self.irc.callbacks:
#debug.printf('Trying to call %s.invalidCommand' % cb.name())
if self.finished:
break
if hasattr(cb, 'invalidCommand'):
@ -381,7 +382,7 @@ class IrcObjectProxy:
name = canonicalName(self.args[0])
cbs = findCallbackForCommand(self, name)
if len(cbs) == 0:
if self.irc.nick == self.msg.nick:
if self.irc.nick == self.msg.nick and not world.testing:
return
for cb in self.irc.callbacks:
if isinstance(cb, PrivmsgRegexp):

View File

@ -35,7 +35,7 @@ import conf
import Owner
class OwnerTestCase(PluginTestCase, PluginDocumentation):
plugins = ()
plugins = ('Utilities',)
def testEval(self):
try:
originalConfAllowEval = conf.allowEval