diff options
author | Adrian Likins <alikins@redhat.com> | 2007-09-24 11:49:34 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2007-09-24 11:49:34 -0400 |
commit | 5fa80f5d7609e60daee6a14476182e73f33c2cf7 (patch) | |
tree | a2016764279b4ab624cc9b41b3c9deeeb56bfaf5 /modules/func_module.py | |
parent | a656879954105065b2fabed8f77993387c73f9b6 (diff) | |
download | third_party-func-5fa80f5d7609e60daee6a14476182e73f33c2cf7.tar.gz third_party-func-5fa80f5d7609e60daee6a14476182e73f33c2cf7.tar.xz third_party-func-5fa80f5d7609e60daee6a14476182e73f33c2cf7.zip |
add some simple support for base object methods
add "module_version", "module_api_version" and "module_description" as
base object methods. All classes based on func_module should get this.
modules should set a self.version, self.api_version, self.description
with approriate values. class or instance variables both work. If
values aren't set, defaults are provided.
alternativelt, the modules can implement and export "module_version",
"module_api_version", and "module_description" themself if they
like
Diffstat (limited to 'modules/func_module.py')
-rwxr-xr-x | modules/func_module.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/modules/func_module.py b/modules/func_module.py index 4bb06d2..7019bc5 100755 --- a/modules/func_module.py +++ b/modules/func_module.py @@ -24,20 +24,41 @@ import traceback class FuncModule(object): + version = "0.0.0" + api_version = "0.0.0" + description = "No Description provided" + def __init__(self): config_obj = config_data.Config() config_result = config_obj.get() self.config = config_result self.__init_log() + self.__base_methods = { + # __'s so we don't clobber useful names + "module_version" : self.__module_version, + "module_api_version" : self.__module_api_version, + "module_description" : self.__module_description, + } def __init_log(self): log = logger.Logger() self.logger = log.logger def register_rpc(self, handlers, module_name): + # add the internal methods, note that this means they + # can get clobbbered by subclass versions + for meth in self.__base_methods: + handlers["%s.%s" % (module_name, meth)] = self.__base_methods[meth] for meth in self.methods: handlers["%s.%s" % (module_name,meth)] = self.methods[meth] - + def __module_version(self): + return self.version + + def __module_api_version(self): + return self.api_version + + def __module_description(self): + return self.description |