def connect_to_couch(self, server_uri, parent=None): """Tries to connect to a CouchDB on a specified Couch URI. Returns the success status of the operation, False for not successful, True for successful """ if parent is None: parent = self.window if not self.serverIO.test_server_url(server_uri): errorDialog(parent, "Could not connect to Faraday Server.", ("Are you sure it is running and that you can " "connect to it? \n Make sure your username and " "password are still valid.")) success = False elif server_uri.startswith("https://"): if not checkSSL(server_uri): errorDialog(self.window, "The SSL certificate validation has failed") success = False else: try: check_faraday_version() except RuntimeError: errorDialog(parent, "The server ir running a different Faraday version then the " "client you are runnung. Version numbers must match!") success = False return success CONF.setCouchUri(server_uri) CONF.saveConfig() self.reload_workspaces() self.open_last_workspace() success = True self.lost_connection_dialog_raised = False return success
def check_faraday_version(): try: server.check_faraday_version() except RuntimeError: getLogger("launcher").error( "The server is running a different Faraday version than the client you are running. Version numbers must match!" ) sys.exit(2)
def check_faraday_version(): try: server.check_faraday_version() except RuntimeError: getLogger("launcher").error("The server is running a different Faraday version than the client " "you are running. Version numbers must match!") sys.exit(2)
def connect_to_couch(self, server_uri, parent=None): """Tries to connect to a CouchDB on a specified Couch URI. Returns the success status of the operation, False for not successful, True for successful """ if parent is None: parent = self.window if not self.serverIO.test_server_url(server_uri): errorDialog(parent, "Could not connect to Faraday Server.", ("Are you sure it is running and that you can " "connect to it? \n Make sure your username and " "password are still valid.")) success = False elif server_uri.startswith("https://"): if not checkSSL(server_uri): errorDialog(self.window, "The SSL certificate validation has failed") success = False else: try: check_faraday_version() except RuntimeError: errorDialog( parent, "The server ir running a different Faraday version then the " "client you are runnung. Version numbers must match!") success = False return success CONF.setCouchUri(server_uri) CONF.saveConfig() self.reload_workspaces() self.open_last_workspace() success = True self.lost_connection_dialog_raised = False return success