Exemple #1
0
    def _edit(self, *args, **kwargs):
        verb = kwargs.get('verb', None)
        self._init_backend()
        self._page.template_name = verb['template']
        self._page.set_action('edit')
        self._page.set_page_value('update_button', True)
        request_data = verb.get('request_data', None)
        server_id = None
        if request_data is not None:
            server_id = request_data.get('id', None)
        if server_id is not None:
            server = self._servers.get(id=server_id)
            macs = self._macs.get(server_id=server_id)
            rib = self._ribs.get(server_id=server_id)
            rib_def = ribs.rib_list()

            self._page.set_title('Edit Server {0} ({1} - {2})'.format(
                server['serial_no'],
                server['manufacturer'],
                server['product_name']))
            self._page.add_page_data({
                'entry_id': server['_id'],
                'server': server,
                'macs': macs,
                'ribs': rib,
                'ribdef': rib_def,
            })
            result = self._prepare_output(
                verb['request_type'], verb['request_content_type'],
                output={'content': self._page.render()})
            return result
Exemple #2
0
 def _index(self, *args, **kwargs):
     verb = kwargs.get('verb', None)
     backend_list = backends.backend_list()
     rib_list = ribs.rib_list()
     page = self._prepare_page(verb)
     page.set_title('DC2 Admincenter - RIBs - Index')
     page.add_page_data({'backendlist': backend_list, 'ribs': rib_list})
     page.set_action('index')
     result = self._prepare_output(verb['request_type'],
                                   verb['request_content_type'],
                                   output={'content': page.render()})
     return result