From 8f32936c7a8c1f24b33c59f57b1766dcfc7676a8 Mon Sep 17 00:00:00 2001 From: meejah Date: Tue, 10 Sep 2019 18:53:54 -0600 Subject: [PATCH] /file works --- src/allmydata/web/filenode.py | 2 +- src/allmydata/web/root.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/allmydata/web/filenode.py b/src/allmydata/web/filenode.py index 71de6e7b9..541c88e05 100644 --- a/src/allmydata/web/filenode.py +++ b/src/allmydata/web/filenode.py @@ -521,5 +521,5 @@ def FileReadOnlyURI(req, filenode): return text_plain(filenode.get_readonly_uri(), req) class FileNodeDownloadHandler(FileNodeHandler): - def childFactory(self, req, name): + def getChild(self, name, req): return FileNodeDownloadHandler(self.client, self.node, name=name) diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 3d8a84135..6e4ac7b17 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -150,16 +150,15 @@ class URIHandler(resource.Resource, object): ) -class FileHandler(rend.Page): +class FileHandler(resource.Resource, object): # I handle /file/$FILECAP[/IGNORED] , which provides a URL from which a # file can be downloaded correctly by tools like "wget". def __init__(self, client): - rend.Page.__init__(self, client) + super(FileHandler, self).__init__() self.client = client - def childFactory(self, ctx, name): - req = IRequest(ctx) + def getChild(self, name, req): if req.method not in ("GET", "HEAD"): raise WebError("/file can only be used with GET or HEAD") # 'name' must be a file URI