예제 #1
0
    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
예제 #2
0
 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
예제 #3
0
 def get_workspaces_names(self):
     return models.get_workspaces_names()
예제 #4
0
 def getWorkspacesNames(self):
     """Returns the names of the workspaces as a list of strings"""
     return get_workspaces_names()
예제 #5
0
 def get_workspaces_names(self):
     return models.get_workspaces_names()
예제 #6
0
 def getWorkspacesNames(self):
     """Returns the names of the workspaces as a list of strings"""
     return get_workspaces_names()