Fixed the Debug plugin actually to work.

This commit is contained in:
Jeremy Fincher 2005-02-01 08:30:58 +00:00
parent 8897e6458b
commit 8512f52e27
2 changed files with 16 additions and 7 deletions

View File

@ -28,15 +28,16 @@
### ###
""" """
Add a description of the plugin (to be presented to the user inside the wizard) This is for developers debugging their plugins; it provides an eval command
here. as well as some other useful commands.
""" """
import supybot import supybot
import supybot.world as world import supybot.world as world
# XXX Replace this with an appropriate author or supybot.Author instance. __version__ = "%%VERSION%%"
__author__ = supybot.authors.unknown
__author__ = supybot.authors.jemfinch
# This is a dictionary mapping supybot.Author instances to lists of # This is a dictionary mapping supybot.Author instances to lists of
# contributions. # contributions.

View File

@ -42,6 +42,7 @@ import exceptions
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
import supybot.ircdb as ircdb
from supybot.commands import * from supybot.commands import *
import supybot.privmsgs as privmsgs import supybot.privmsgs as privmsgs
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
@ -53,12 +54,19 @@ def getTracer(fd):
print >>fd, '%s: %s' % (code.co_filename, code.co_name) print >>fd, '%s: %s' % (code.co_filename, code.co_name)
return tracer return tracer
class Debug(privmsgs.CapabilityCheckingPrivmsg): class Debug(callbacks.Privmsg):
capability = 'owner' capability = 'owner'
def __init__(self): def __init__(self, irc):
# Setup exec command. # Setup exec command.
self.__parent = super(Debug, self)
self.__parent.__init__(irc)
setattr(self.__class__, 'exec', self.__class__._exec) setattr(self.__class__, 'exec', self.__class__._exec)
privmsgs.CapabilityCheckingPrivmsg.__init__(self)
def callCommand(self, name, irc, msg, *args, **kwargs):
if ircdb.checkCapability(msg.prefix, self.capability):
self.__parent.callCommand(name, irc, msg, *args, **kwargs)
else:
irc.errorNoCapability(self.capability)
_evalEnv = {'_': None, _evalEnv = {'_': None,
'__': None, '__': None,