mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-26 22:30:02 +00:00
vdrive/webish: finish verifierid/uri transition
This commit is contained in:
parent
453f0b47e4
commit
43f32e8c9b
@ -41,7 +41,7 @@ class VDrive(service.MultiService):
|
|||||||
d.addCallback(_check)
|
d.addCallback(_check)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def get_verifierid_from_parent(self, parent, filename):
|
def get_uri_from_parent(self, parent, filename):
|
||||||
assert not isinstance(parent, str), "'%s' isn't a directory node" % (parent,)
|
assert not isinstance(parent, str), "'%s' isn't a directory node" % (parent,)
|
||||||
d = parent.callRemote("list")
|
d = parent.callRemote("list")
|
||||||
def _find(table):
|
def _find(table):
|
||||||
@ -110,12 +110,12 @@ class VDrive(service.MultiService):
|
|||||||
def remove(self, parent, name):
|
def remove(self, parent, name):
|
||||||
assert not isinstance(parent, str)
|
assert not isinstance(parent, str)
|
||||||
log.msg("vdrive removing %s" % name)
|
log.msg("vdrive removing %s" % name)
|
||||||
# first find the verifierid
|
# first find the uri
|
||||||
d = self.get_verifierid_from_parent(parent, name)
|
d = self.get_uri_from_parent(parent, name)
|
||||||
def _got_verifierid(vid):
|
def _got_uri(vid):
|
||||||
# TODO: delete the file's shares using this
|
# TODO: delete the file's shares using this
|
||||||
pass
|
pass
|
||||||
d.addCallback(_got_verifierid)
|
d.addCallback(_got_uri)
|
||||||
def _delete_from_parent(res):
|
def _delete_from_parent(res):
|
||||||
return parent.callRemote("remove", name)
|
return parent.callRemote("remove", name)
|
||||||
d.addCallback(_delete_from_parent)
|
d.addCallback(_delete_from_parent)
|
||||||
@ -143,7 +143,7 @@ class VDrive(service.MultiService):
|
|||||||
dir_or_path, name = dir_and_name_or_path
|
dir_or_path, name = dir_and_name_or_path
|
||||||
d = self.dirpath(dir_or_path)
|
d = self.dirpath(dir_or_path)
|
||||||
def _got_dir(dirnode):
|
def _got_dir(dirnode):
|
||||||
return self.get_verifierid_from_parent(dirnode, name)
|
return self.get_uri_from_parent(dirnode, name)
|
||||||
d.addCallback(_got_dir)
|
d.addCallback(_got_dir)
|
||||||
else:
|
else:
|
||||||
rslash = dir_and_name_or_path.rfind("/")
|
rslash = dir_and_name_or_path.rfind("/")
|
||||||
@ -151,17 +151,17 @@ class VDrive(service.MultiService):
|
|||||||
# we're looking for a file in the root directory
|
# we're looking for a file in the root directory
|
||||||
dir = self.gvd_root
|
dir = self.gvd_root
|
||||||
name = dir_and_name_or_path
|
name = dir_and_name_or_path
|
||||||
d = self.get_verifierid_from_parent(dir, name)
|
d = self.get_uri_from_parent(dir, name)
|
||||||
else:
|
else:
|
||||||
dirpath = dir_and_name_or_path[:rslash]
|
dirpath = dir_and_name_or_path[:rslash]
|
||||||
name = dir_and_name_or_path[rslash+1:]
|
name = dir_and_name_or_path[rslash+1:]
|
||||||
d = self.dirpath(dirpath)
|
d = self.dirpath(dirpath)
|
||||||
d.addCallback(lambda dir:
|
d.addCallback(lambda dir:
|
||||||
self.get_verifierid_from_parent(dir, name))
|
self.get_uri_from_parent(dir, name))
|
||||||
|
|
||||||
def _got_verifierid(verifierid):
|
def _got_uri(uri):
|
||||||
return dl.download(verifierid, download_target)
|
return dl.download(uri, download_target)
|
||||||
d.addCallback(_got_verifierid)
|
d.addCallback(_got_uri)
|
||||||
def _done(res):
|
def _done(res):
|
||||||
log.msg("finished getting file")
|
log.msg("finished getting file")
|
||||||
return res
|
return res
|
||||||
|
@ -127,7 +127,7 @@ class Directory(rend.Page):
|
|||||||
# to be invoked, which deletes the file and then redirects the
|
# to be invoked, which deletes the file and then redirects the
|
||||||
# browser back to this directory
|
# browser back to this directory
|
||||||
del_url = url.here.child("_delete")
|
del_url = url.here.child("_delete")
|
||||||
#del_url = del_url.add("verifierid", idlib.b2a(target))
|
#del_url = del_url.add("uri", idlib.b2a(target))
|
||||||
del_url = del_url.add("name", name)
|
del_url = del_url.add("name", name)
|
||||||
delete = T.form(action=del_url, method="post")[
|
delete = T.form(action=del_url, method="post")[
|
||||||
T.input(type='submit', value='del', name="del"),
|
T.input(type='submit', value='del', name="del"),
|
||||||
@ -243,10 +243,10 @@ class TypedFile(static.File):
|
|||||||
self.defaultType)
|
self.defaultType)
|
||||||
|
|
||||||
class Downloader(resource.Resource):
|
class Downloader(resource.Resource):
|
||||||
def __init__(self, downloader, name, verifierid):
|
def __init__(self, downloader, name, uri):
|
||||||
self._downloader = downloader
|
self._downloader = downloader
|
||||||
self._name = name
|
self._name = name
|
||||||
self._verifierid = verifierid
|
self._uri = uri
|
||||||
|
|
||||||
def render(self, ctx):
|
def render(self, ctx):
|
||||||
req = inevow.IRequest(ctx)
|
req = inevow.IRequest(ctx)
|
||||||
@ -262,7 +262,7 @@ class Downloader(resource.Resource):
|
|||||||
t = WebDownloadTarget(req)
|
t = WebDownloadTarget(req)
|
||||||
#dl = IDownloader(ctx)
|
#dl = IDownloader(ctx)
|
||||||
dl = self._downloader
|
dl = self._downloader
|
||||||
dl.download(self._verifierid, t)
|
dl.download(self._uri, t)
|
||||||
return server.NOT_DONE_YET
|
return server.NOT_DONE_YET
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user