def handle_parameters(self): """ Retrieve the parameters selected on the web page These parameters are static to the current class, so they are shared between all browsers connected on this server. """ # call parent ViewHandler.handle_parameters(self) # get owned parameters form = self.context.form # update CPU statistics selection cpuid = form.get('idx') if cpuid: try: cpuid = int(cpuid) except ValueError: self.message(error_message('Cpu id is not an integer: {}'.format(cpuid))) else: address_stats = self.get_address_stats() if cpuid < len(address_stats.cpu): if HostAddressView.cpu_id_stats != cpuid: self.logger.info('select cpu#{} statistics for address'.format(self.cpu_id_to_string(cpuid))) HostAddressView.cpu_id_stats = cpuid else: self.message(error_message('Incorrect stats cpu id: {}'.format(cpuid))) # update Network statistics selection interface = form.get('intf') if interface: # check if interface requested exists address_stats = self.get_address_stats() if interface in address_stats.io.keys(): if HostAddressView.interface_stats != interface: self.logger.info('select Interface graph for {}'.format(interface)) HostAddressView.interface_stats = interface else: self.message(error_message('Incorrect stats interface: {}'.format(interface)))
def render(self): """ Method called by Supervisor to handle the rendering of the Supvisors Application page. """ self.application_name = self.context.form.get('appli') if not self.application_name: self.logger.error('no application') elif self.application_name not in self.supvisors.context.applications.keys(): self.logger.error('unknown application: {}'.format(self.application_name)) else: # Force the call to the render method of ViewHandler return ViewHandler.render(self)
def render(self): """ Method called by Supervisor to handle the rendering of the Supvisors Address page. """ # Force the call to the render method of ViewHandler return ViewHandler.render(self)
def test_TODO(self): """ Test the values set at construction. """ from supvisors.viewhandler import ViewHandler handler = ViewHandler() self.assertIsNotNone(handler)