Пример #1
0
 def list_directories(self, subdir):
     url = '/api2/repos/%s/dir/' % self.id
     query = '?p=%s&t=d' % subdir
     resp = self.client.get(url + query)
     dir_id = resp.headers['oid']
     dir_json = resp.json()
     dir = SeafDir(self, subdir, dir_id)
     dir.load_entries(dir_json)
     return dir
Пример #2
0
    def get_dir(self, path):
        """Get the dir object located in `path` in this repo.

        Return a :class:`SeafDir` object
        """
        assert path.startswith('/')
        url = '/api2/repos/%s/dir/' % self.id
        query = '?' + urlencode(dict(p=path))
        resp = self.client.get(url + query)
        dir_id = resp.headers['oid']
        dir_json = resp.json()
        dir = SeafDir(self, path, dir_id)
        dir.load_entries(dir_json)
        return dir
Пример #3
0
    def get_dir(self, path):
        """Get the dir object located in `path` in this repo.

        Return a :class:`SeafDir` object
        """
        assert path.startswith('/')
        url = '/api2/repos/%s/dir/' % self.id
        query = '?' + urlencode(dict(p=path))
        resp = self.client.get(url + query)
        dir_id = resp.headers['oid']
        dir_json = resp.json()
        dir = SeafDir(self, path, dir_id)
        dir.load_entries(dir_json)
        return dir