예제 #1
0
 def reloadStage2(self):
     #disconnect before reloading dispatchers
     self._disconnect(self.oldservers)
     # Reset Dispatcher loaded modules
     # get a list of previously loaded modules so can track stale modules
     oldmodules = set(Dispatcher.MODULEDICT.keys())
     Dispatcher.reset()
     #create databases so init() can do database things.
     self.createDatabases(self.newservers)
     for server in self.servers.itervalues():
         server.initializeReload()
     Dispatcher.showLoadErrors()
     #compare currently loaded modules to oldmodules
     oldmodules = oldmodules.difference(set(Dispatcher.MODULEDICT.keys()))
     #remove oldmodules from sys.modules
     for module in oldmodules:
         module = "pyBurlyBot_%s" % module  #prefix as was set in Dispatcher.load
         print "Removing module: %s" % module
         try:
             del modules[module]
         except KeyError:
             print "WARNING: module was never in modules %s" % module
     # connect after load dispatchers
     self._connect(self.newservers)
     self.oldservers = self.newservers = []
예제 #2
0
	def reloadStage2(self):
		#disconnect before reloading dispatchers
		self._disconnect(self.oldservers)
		# Reset Dispatcher loaded modules
		# get a list of previously loaded modules so can track stale modules
		oldmodules = set(Dispatcher.MODULEDICT.keys())
		Dispatcher.reset()
		#create databases so init() can do database things.
		self.createDatabases(self.newservers)
		for server in self.servers.itervalues():
			server.initializeReload()
		Dispatcher.showLoadErrors()
		#compare currently loaded modules to oldmodules
		oldmodules = oldmodules.difference(set(Dispatcher.MODULEDICT.keys()))
		#remove oldmodules from sys.modules
		for module in oldmodules:
			print "Removing module: %s" % module
			try: del modules[module]
			except KeyError:
				print "WARNING: module was never in modules %s" % module
		# connect after load dispatchers
		self._connect(self.newservers)
		self.oldservers = self.newservers = []