Ejemplo n.º 1
0
    def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir):
        from fs.contrib.tahoelafs import TahoeLAFS

        if '/uri/' not in fs_path:
            raise OpenerError("""Tahoe-LAFS url should be in the form <url>/uri/<dicap>""")

        url, dircap = fs_path.split('/uri/')
        path = ''
        if '/' in dircap:
            dircap, path = dircap.split('/', 1)

        fs = TahoeLAFS(dircap, webapi=url)

        if '/' in path:
            dirname, _resourcename = pathsplit(path)
            if create_dir:
                fs = fs.makeopendir(dirname)
            else:
                fs = fs.opendir(dirname)
            path = ''

        return fs, path
Ejemplo n.º 2
0
 def setUp(self):
     self.dircap = TahoeLAFS.createdircap(WEBAPI)
     self.fs = TahoeLAFS(self.dircap, cache_timeout=0, webapi=WEBAPI)