Example #1
0
 def _new(self, *args, **kwargs):
     verb = kwargs.get('verb', None)
     page = self._prepare_page(verb)
     backend = backends.backend_new()
     backendlist = backends.backend_list()
     page.set_title('DC2 Admincenter - Backends - Add')
     page.add_page_data({
         'backendlist': backendlist,
         'backend': convert_values(backend)})
     page.set_action('new')
     result = self._prepare_output(verb['request_type'],
                                   verb['request_content_type'],
                                   output={'content': page.render()})
     return result
Example #2
0
 def _edit(self, *args, **kwargs):
     params = web.input()
     verb = kwargs.get('verb', None)
     page = self._prepare_page(verb)
     backendlist = backends.backend_list()
     backend_id = params.get('backend_id', None)
     backend = backends.backend_get({'_id': backend_id})
     self._init_backend(backend)
     environment = self._environments.get(id=verb['request_data']['id'])
     page.set_title('DC2 Admincenter - Backends - Environment - Edit')
     page.set_action('edit')
     page.add_page_data({
         'backendlist': backendlist,
         'backend_id': backend_id,
         'environment': convert_values(environment)
     })
     result = self._prepare_output(verb['request_type'],
                                   verb['request_content_type'],
                                   output={'content': page.render()})
     return result