From 6e86096f2b9ca989fce5c612761d289ef81e0829 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 30 Jul 2010 06:56:37 -0500 Subject: [PATCH] some comments in the module reload --- Module.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Module.py b/Module.py index 261cfe3..f26b84a 100644 --- a/Module.py +++ b/Module.py @@ -127,11 +127,17 @@ class Module(object): def reload(self, connection, event, nick, userhost, replypath, what, admin_unlocked): whats = what.split(' ') if whats[0] == 'reload' and admin_unlocked: + # re-read and re-compile module from source on disk reload(sys.modules[self.__module__]) + + # find the class declaration for the current module for name, obj in inspect.getmembers(sys.modules[self.__module__]): if inspect.isclass(obj) and str(obj).find(self.__module__) > 0: + # remove existing object from in-memory stuff self.modlist.remove(self) self.unregister_handlers() + + # create new object, like how we did initially obj(self.config, self.server, self.modlist) # Utility method to do the proper type of reply (either to IRC, or as a return