some comments in the module reload
This commit is contained in:
parent
0fc9a325fb
commit
6e86096f2b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue