예제 #1
0
def check_faraday_version():
    try:
        server.check_faraday_version()
    except RuntimeError:
        get_logger("launcher").error(
            "The server is running a different Faraday version than the client you are running. Version numbers must match!"
        )
예제 #2
0
    def connect_to_couch(self, server_url, 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.check_server_url(server_url):
            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_url.startswith("https://"):
            if not checkSSL(server_url):
                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.setAPIUrl(server_url)
            CONF.saveConfig()
            self.reload_workspaces()
            self.open_last_workspace()
            success = True
            self.lost_connection_dialog_raised = False
        return success