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