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: CONF.setCouchUri(server_uri) CONF.saveConfig() self.reload_workspaces() self.open_last_workspace() success = True self.lost_connection_dialog_raised = False return success
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 connect_to_couch(self, couch_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 CouchDbManager.testCouch(couch_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 couch_uri.startswith("https://"): if not checkSSL(couch_uri): errorDialog(self.window, "The SSL certificate validation has failed") success = False else: CONF.setCouchUri(couch_uri) CONF.saveConfig() self.reload_workspaces() self.open_last_workspace() success = True self.lost_connection_dialog_raised = False return success
def on_click_OK(self, button): """Defines what happens when user clicks OK button""" repourl = self.entry.get_text() if not CouchDbManager.testCouch(repourl): errorDialog(self, "The provided URL is not valid", "Are you sure CouchDB is running?") elif repourl.startswith("https://"): if not checkSSL(repourl): errorDialog("The SSL certificate validation has failed") else: CONF.setCouchUri(repourl) CONF.saveConfig() self.reloadWorkspaces() self.destroy()
def _showRepositoryConfigDialog(self): repoconfig_dialog = RepositoryConfigDialog(self, CONF.getCouchURI(), CONF.getCouchIsReplicated(), CONF.getCouchReplics(), callback=None) result = repoconfig_dialog.exec_loop() if result == qt.QDialog.Accepted: repourl, isReplicated, replics = repoconfig_dialog.getData() api.devlog("repourl = %s" % repourl) wm = self._main_app.getWorkspaceManager() if not CouchDbManager.testCouch(repourl): self.showPopup(""" Repository URL Not valid, check if service is available and that connection string is from the form: http[s]://hostname:port""") return if repourl.startswith("https://"): if not checkSSL(repourl): self.showPopup(""" SSL certificate validation failed. You can use the --cert option in Faraday to set the path of the cert """) return CONF.setCouchUri(repourl) CONF.setCouchIsReplicated(isReplicated) CONF.setCouchReplics(replics) CONF.saveConfig() wm.closeWorkspace() wm.resource() wm.openWorkspace('untitled') mwin = self._main_app.getMainWindow() mwin.getWorkspaceTreeView().loadAllWorkspaces() mwin.getWorkspaceTreeView().setDefaultWorkspace()
def _showRepositoryConfigDialog(self): repoconfig_dialog = RepositoryConfigDialog(self, CONF.getCouchURI(), CONF.getCouchIsReplicated(), CONF.getCouchReplics(), callback=None) result = repoconfig_dialog.exec_loop() if result == qt.QDialog.Accepted: repourl, isReplicated, replics = repoconfig_dialog.getData() api.devlog("repourl = %s" % repourl) wm = self._main_app.getWorkspaceManager() if not CouchDbManager.testCouch(repourl): self.showPopup(""" Repository URL Not valid, check if service is available and that connection string is from the form: http[s]://hostname:port""") return if repourl.startswith("https://"): if not checkSSL(repourl): self.showPopup( """ SSL certificate validation failed. You can use the --cert option in Faraday to set the path of the cert """) return CONF.setCouchUri(repourl) CONF.setCouchIsReplicated(isReplicated) CONF.setCouchReplics(replics) CONF.saveConfig() wm.closeWorkspace() wm.resource() wm.openWorkspace('untitled') mwin = self._main_app.getMainWindow() mwin.getWorkspaceTreeView().loadAllWorkspaces() mwin.getWorkspaceTreeView().setDefaultWorkspace()
def connect_to_couch(self, couch_uri): """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 not CouchDbManager.testCouch(couch_uri): errorDialog(self.window, "Could not connect to CouchDB.", ("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 couch_uri.startswith("https://"): if not checkSSL(couch_uri): errorDialog(self.window, "The SSL certificate validation has failed") success = False else: CONF.setCouchUri(couch_uri) CONF.saveConfig() self.reloadWorkspaces() success = True return success
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