Package SPyRO :: Module codepools :: Class CodePool
[hide private]
[frames] | no frames]

Class CodePool

source code

Register python modules and executes functions in modules. The registration of objects must not be used, instead a list of module's path is given. The registrarion is supported to serve setsend calls. The getobj method reads modules from path. The module is loaded the first time that is requested, next requests uses a cached version of the module. If the module changes in the disk, is reloaded (if checkupdates=True, True by default). Every time that the module is readed it can execute global statments

Instance Methods [hide private]
 
__init__(self, path, checkupdates=True, codeloader=None)
Init the ServerObjectPool object with a
source code
 
setobj(self, name, obj, authobj=None)
Register an object |obj| with the ID |name|
source code
 
_import_(self, name, _globals, _locals, fromlist)
Replace function of __import__ to support import modules from the code pool
source code
 
_reload_(self, mod)
Reload an SPyRO module or a python module
source code
 
getobj(self, name)
Get an object and its authorization data, it must raise a KeyError exception if |name| is not present in the pool
source code
 
loadmodule(self, name, authobj)
Loads a python's module in the object path (self.path) The authority object is set to the |_spyro_authentication| global variable in the module.
source code
 
delobj(self, name)
Remove an object with name |name|
source code
 
setsend(self, newid, ret, auth=None)
Register an object (to send by reference)
source code
Method Details [hide private]

loadmodule(self, name, authobj)

source code 
Loads a python's module in the object path (self.path) The authority object is set to the |_spyro_authentication| global variable in the module. If it is not present the |authobj| argument is used instead.