Changed reload to not unload the module if there's an error in loading.

This commit is contained in:
Jeremy Fincher 2003-05-19 13:47:19 +00:00
parent b633960740
commit 345f819e7a
1 changed files with 8 additions and 7 deletions

View File

@ -279,17 +279,18 @@ class OwnerCommands(CapabilityCheckingPrivmsg):
name = getArgs(args)
callbacks = irc.removeCallback(name)
if callbacks:
for callback in callbacks:
callback.die()
try:
moduleInfo = imp.find_module(name)
module = imp.load_module(name, *moduleInfo)
callback = module.Class()
irc.addCallback(callback)
for callback in callbacks:
callback.die()
irc.reply(msg, conf.replySuccess)
except ImportError:
for callback in callbacks:
irc.addCallback(callback)
irc.error(msg, 'No plugin %s exists.' % name)
return
module = imp.load_module(name, *moduleInfo)
callback = module.Class()
irc.addCallback(callback)
irc.reply(msg, conf.replySuccess)
else:
irc.error(msg, 'There was no callback %s.' % name)