Ejemplo n.º 1
0
 def get_workspaces(self):
     rest_url = urljoin(self.service_url, "workspaces.xml")
     description = self.get_xml(rest_url)
     return [
         workspace_from_index(self, node)
         for node in description.findall("workspace")
     ]
Ejemplo n.º 2
0
    def get_workspaces(self, names=None):
        '''
          Returns a list of workspaces in the catalog.
          If names is specified, will only return workspaces that match.
          names can either be a comma delimited string or an array.
          Will return an empty list if no workspaces are found.
        '''
        if names is None:
            names = []
        elif isinstance(names, basestring):
            names = map(str.strip, str(names).split(','))

        description = self.get_xml("%s/workspaces.xml" % self.service_url)
        workspaces = []
        workspaces.extend([
            workspace_from_index(self, node)
            for node in description.findall("workspace")
        ])

        if workspaces and names:
            named_workspaces = []
            for ws in workspaces:
                if ws.name in names:
                    named_workspaces.append(ws)
            return named_workspaces

        return workspaces
Ejemplo n.º 3
0
 def get_workspaces(self):
     rest_url = urljoin(
         self.service_url,
         "workspaces.xml"
     )
     description = self.get_xml(rest_url)
     return [workspace_from_index(self, node)
             for node in description.findall("workspace")]
Ejemplo n.º 4
0
    def get_workspaces(self, names=None):
        '''
          Returns a list of workspaces in the catalog.
          If names is specified, will only return workspaces that match.
          names can either be a comma delimited string or an array.
          Will return an empty list if no workspaces are found.
        '''
        if names is None:
            names = []
        elif isinstance(names, basestring):
            names = [s.strip() for s in names.split(',') if s.strip()]

        data = self.get_xml("{}/workspaces.xml".format(self.service_url))
        workspaces = []
        workspaces.extend([workspace_from_index(self, node) for node in data.findall("workspace")])

        if workspaces and names:
            return ([ws for ws in workspaces if ws.name in names])

        return workspaces
Ejemplo n.º 5
0
    def get_workspaces(self, names=None):
        '''
          Returns a list of workspaces in the catalog.
          If names is specified, will only return workspaces that match.
          names can either be a comma delimited string or an array.
          Will return an empty list if no workspaces are found.
        '''
        if names is None:
            names = []
        elif isinstance(names, basestring):
            names = [s.strip() for s in names.split(',') if s.strip()]

        data = self.get_xml("{}/workspaces.xml".format(self.service_url))
        workspaces = []
        workspaces.extend([workspace_from_index(self, node) for node in data.findall("workspace")])

        if workspaces and names:
            return ([ws for ws in workspaces if ws.name in names])

        return workspaces
Ejemplo n.º 6
0
 def get_workspaces(self):
     description = self.get_xml("%s/workspaces.xml" % self.service_url)
     return [
         workspace_from_index(self, node)
         for node in description.findall("workspace")
     ]
Ejemplo n.º 7
0
 def get_default_workspace(self):
     ws = Workspace(self, "default")
     # must fetch and resolve the 'real' workspace from the response
     ws.fetch()
     return workspace_from_index(self, ws.dom)
Ejemplo n.º 8
0
 def get_workspaces(self):
     description = self.get_xml("%s/workspaces.xml" % self.service_url)
     return [workspace_from_index(self, node) for node in description.findall("workspace")]
Ejemplo n.º 9
0
 def get_default_workspace(self):
     ws = Workspace(self, "default")
     # must fetch and resolve the 'real' workspace from the response
     ws.fetch()
     return workspace_from_index(self, ws.dom)