def openWorkspace(self, name): """Open a workspace by name. Returns the workspace. Raises an WorkspaceException if something went wrong along the way. """ if name not in get_workspaces_names(): raise WorkspaceException("Workspace %s wasn't found" % name) try: workspace = get_workspace(name) except Unauthorized: raise WorkspaceException( ("You're not authorized to access this workspace\n" "Add your credentials to your user configuration " "file in $HOME/.faraday/config/user.xml\n" "For example: " "<couch_uri>http://john:[email protected]:5984</couch_uri>")) except Exception as e: notification_center.DBConnectionProblem(e) raise WorkspaceException(str(e)) self.mappersManager.createMappers(name) self.setActiveWorkspace(workspace) notification_center.workspaceChanged(workspace) return workspace
def openWorkspace(self, name): """Open a workspace by name. Returns the workspace. Raises an WorkspaceException if something went wrong along the way. """ if name not in get_workspaces_names(): raise WorkspaceException( "Workspace %s wasn't found" % name) self.closeWorkspace() try: workspace = get_workspace(name) except Unauthorized: raise WorkspaceException( ("You're not authorized to access this workspace\n" "Add your credentials to your user configuration " "file in $HOME/.faraday/config/user.xml\n" "For example: " "<couch_uri>http://john:[email protected]:5984</couch_uri>")) except Exception as e: notification_center.CouchDBConnectionProblem(e) raise WorkspaceException(str(e)) self.mappersManager.createMappers(name) self.setActiveWorkspace(workspace) notification_center.workspaceChanged(workspace) return workspace
def get_workspaces_names(self): return models.get_workspaces_names()
def getWorkspacesNames(self): """Returns the names of the workspaces as a list of strings""" return get_workspaces_names()