From 4a274173556d7366604160abbfeb57b51b4eb53b Mon Sep 17 00:00:00 2001 From: makkalot Date: Sun, 1 Jun 2008 13:37:51 +0300 Subject: get_method args implemented also has backward support --- func/minion/modules/func_module.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'func/minion') diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py index edb554c..e2a47c3 100644 --- a/func/minion/modules/func_module.py +++ b/func/minion/modules/func_module.py @@ -81,16 +81,45 @@ class FuncModule(object): return True return False - def get_method_args(self,name): + def __get_method_args(self): """ Gets arguments with their formats according to ArgCompatibility class' rules. - @param :name The name of the method @return : dict with args or Raise Exception if something wrong happens """ - pass + tmp_arg_dict = self.__register_method_args() + + #if it is not implemeted then return empty stuff + if not tmp_arg_dict: + return {} + + #or go ahead + #see if user tried to register an not implemented method :) + for method in tmp_arg_dict.keys(): + if not hasattr(self,method): + raise NonExistingMethodRegistered("%s is not in %s "%(method,self.__class__.__name__)) + + #create argument validation instance + self.arg_comp = ArgCompatibility(tmp_arg_dict) + #see if the options that were used are OK.. + self.arg_comp.validate_all() + + return tmp_arg_dict + + def __register_method_args(self): + """ + That is the method where users should override in their + modules according to be able to send their method arguments + to the Overlord. If they dont have it nothing breaks + just that one in the base class is called + + @return : empty {} + """ + + # to know they didnt implement it + return {} def __is_all_args_registered(self,name): """ -- cgit