def remote_widget_render(self): print "\n******testing minion : %s**********" % (self.minion) fc = Overlord(self.minion) modules = fc.system.list_modules() display_modules = {} print "Getting the modules that has exported arguments" for module in modules.itervalues(): for mod in module: #if it is not empty exported_methods = getattr(fc, mod).get_method_args()[self.minion] if exported_methods: print "%s will be rendered" % (mod) display_modules[mod] = exported_methods #do the rendering work here for module, exp_meths in display_modules.iteritems(): for method_name, other_options in exp_meths.iteritems(): minion_arguments = other_options['args'] if minion_arguments: wlist_object = WidgetListFactory(minion_arguments, minion=self.minion, module=module, method=method_name) wlist_object = wlist_object.get_widgetlist_object() #print wlist_object wf = WidgetSchemaFactory(minion_arguments) schema_man = wf.get_ready_schema() minion_form = RemoteFormAutomation(wlist_object, schema_man) print "%s.%s.%s rendered" % (self.minion, module, method_name)
def method_display(self, minion=None, module=None, method=None): """ That method generates the input widget for givent method. """ global global_form if self.func_cache['minion_name'] == minion: fc = self.func_cache['fc_object'] else: fc = Overlord(minion) self.func_cache['fc_object'] = fc self.func_cache['minion_name'] = minion #reset the children :) self.func_cache['module_name'] = module self.func_cache['modules'] = None self.func_cache['methods'] = None #get the method args method_args = getattr(fc, module).get_method_args() if not method_args.values(): #print "Not registered method here" return dict(minion_form=None, minion=minion, module=module, method=method) minion_arguments = method_args[minion][method]['args'] #the description of the method we are going to display if method_args[minion][method].has_key('description'): description = method_args[minion][method]['description'] else: description = None if minion_arguments: wlist_object = WidgetListFactory(minion_arguments, minion=minion, module=module, method=method) wlist_object = wlist_object.get_widgetlist_object() #create the validation parts for the remote form wf = WidgetSchemaFactory(minion_arguments) schema_man = wf.get_ready_schema() #create the final form minion_form = RemoteFormAutomation(wlist_object, schema_man) global_form = minion_form.for_widget #print global_form #i use that when something goes wrong to check the problem better to stay here ;) #self.minion_form =RemoteFormFactory(wlist_object,schema_man).get_remote_form() del wlist_object del minion_arguments return dict(minion_form=minion_form, minion=minion, module=module, method=method, description=description) else: return dict(minion_form=None, minion=minion, module=module, method=method, description=description)