This commit is contained in:
Jeremy Fincher 2003-10-24 09:03:34 +00:00
parent d54ec97253
commit 300004ca62
2 changed files with 5 additions and 4 deletions

View File

@ -72,6 +72,7 @@ def loadPluginModule(name):
def loadPluginClass(irc, module):
"""Loads the plugin Class from the given module into the given irc."""
callback = module.Class()
assert not irc.getCallback(callback.name())
irc.addCallback(callback)
if hasattr(callback, 'configure'):
callback.configure(irc)
@ -285,10 +286,9 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
the end.
"""
name = privmsgs.getArgs(args)
for cb in irc.callbacks:
if cb.name() == name:
irc.error(msg, 'That module is already loaded.')
return
if irc.getCallback(name):
irc.error(msg, 'That module is already loaded.')
return
try:
module = loadPluginModule(name)
except ImportError, e:

View File

@ -83,6 +83,7 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation):
def testLoad(self):
self.assertError('load Owner')
self.assertError('load owner')
self.assertNotError('load Misc')
self.assertNotError('list Owner')