def connect(): """Connects to the stats client, using the endpoint that's passed in the POST body. """ def _ask_connection(): return render_template('connect.html', endpoints=app.discovery_thread.get_endpoints()) if request.method == 'GET': return _ask_connection() elif request.method == 'POST': # if we got an endpoint in the POST body, store it. if request.forms.endpoint is None: return _ask_connection() endpoint_input = request.forms.endpoint endpoint_select = request.forms.endpoint_select if endpoint_select: endpoint = endpoint_select else: endpoint = endpoint_input client = connect_to_circus(endpoint) if not client.connected: set_message('Impossible to connect') redirect(url('index'))
def connect(): """Connects to the stats client, using the endpoint that's passed in the POST body. """ def _ask_connection(): return render_template('connect.html') if request.method == 'GET': return _ask_connection() elif request.method == 'POST': # if we got an endpoint in the POST body, store it. if request.forms.endpoint is None: return _ask_connection() endpoint = request.forms.endpoint client = connect_to_circus(endpoint) if not client.connected: set_message('Impossible to connect') redirect('/')
def disconnect(): if disconnect_from_circus(): set_message('You are now disconnected') redirect(url('index'))
def disconnect(): if disconnect_from_circus(): set_message('You are now disconnected') redirect('/')