def refresh(request): for f in (TerminateInstance, RebootInstance): form, handled = f.maybe_handle(request) if handled: return handled instances = [] try: instances = api.admin_server_list(request) except Exception as e: if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to get instance list: %s') % e.message) # We don't have any way of showing errors for these, so don't bother # trying to reuse the forms from above terminate_form = TerminateInstance() reboot_form = RebootInstance() return render_to_response( 'syspanel/instances/_list.html', { 'instances': instances, 'terminate_form': terminate_form, 'reboot_form': reboot_form, }, context_instance=template.RequestContext(request))
def refresh(request): for f in (TerminateInstance, RebootInstance): form, handled = f.maybe_handle(request) if handled: return handled instances = [] try: instances = api.admin_server_list(request) except Exception as e: if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to get instance list: %s') % e.message) # We don't have any way of showing errors for these, so don't bother # trying to reuse the forms from above terminate_form = TerminateInstance() reboot_form = RebootInstance() return render_to_response( 'syspanel/instances/_list.html', { 'instances': instances, 'terminate_form': terminate_form, 'reboot_form': reboot_form, }, context_instance=template.RequestContext(request))
def get_data(self): instances = [] try: instances = api.admin_server_list(self.request) except: exceptions.handle(self.request, _('Unable to retrieve instance list.')) return instances