Aimy

coreload

The Core.coreload() method first triggers a function call to the __decore__() method of its root object and all it service items, then reloads all python code and reinstates data collected by the "decore" calls by passing it back to each recreated item's __encore__() method.

__decore__

To implement the __decore__() method in any object based on the core package's core_basic class, simply call the inherrited __decore__ method and store the dict it returns. Place your data in the "core" key of the returned dict, then return the dict.

__encore__

The __encore__ method must accept a dict as it's argument. Take your data from the dict's "core" key and restore your object's data and connections after

Here's a simple example class:

	
	from core import service
	
	class MyService(service.Service):
		
		def __init__(self, config=None, *args, **kwargs):
			service.Service.__init__(self, config, *args)
			self.__someInfo = kwargs.get('info')
			
		def __decore__(self):
			data = service.Service.__decore__()
			data['core']['someInfo'] = self.__someInfo
		
		def __encore__(self, data):
			self.__someInfo = data['core']['someInfo']
			
		

Now you can add your class to the root object's services and it will maintain its someInfo data when there's a coreload.