From 300004ca6224a8595a8532a508eecbec43b4a9b7 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 24 Oct 2003 09:03:34 +0000 Subject: [PATCH] Fix for bug #829300 --- src/Owner.py | 8 ++++---- test/test_Owner.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Owner.py b/src/Owner.py index 641efd4d8..54ed76e49 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -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: diff --git a/test/test_Owner.py b/test/test_Owner.py index 521c05305..0b63b7807 100644 --- a/test/test_Owner.py +++ b/test/test_Owner.py @@ -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')