From: Daira Hopwood Date: Thu, 5 Sep 2013 17:04:22 +0000 (+0100) Subject: Sun May 13 03:19:43 BST 2012 Brian Warner X-Git-Url: https://git.rkrishnan.org/zeppelin?a=commitdiff_plain;h=dad6b6180e7af4d1afed03218cbacc69649e8eaf;p=tahoe-lafs%2Ftahoe-lafs.git Sun May 13 03:19:43 BST 2012 Brian Warner * webapi: remove undocumented t=mkdir-p operation Closes #380 --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index df4bb00f..1c7dadae 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -1821,25 +1821,6 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(self.failUnlessNodeKeysAre, [u"baz.txt"]) return d - def test_PUT_NEWDIRURL_mkdir_p(self): - d = defer.succeed(None) - d.addCallback(lambda res: self.POST(self.public_url + "/foo", t='mkdir', name='mkp')) - d.addCallback(lambda res: self.failUnlessNodeHasChild(self._foo_node, u"mkp")) - d.addCallback(lambda res: self._foo_node.get(u"mkp")) - def mkdir_p(mkpnode): - url = '/uri/%s?t=mkdir-p&path=/sub1/sub2' % urllib.quote(mkpnode.get_uri()) - d = self.POST(url) - def made_subsub(ssuri): - d = self._foo_node.get_child_at_path(u"mkp/sub1/sub2") - d.addCallback(lambda ssnode: self.failUnlessReallyEqual(ssnode.get_uri(), ssuri)) - d = self.POST(url) - d.addCallback(lambda uri2: self.failUnlessReallyEqual(uri2, ssuri)) - return d - d.addCallback(made_subsub) - return d - d.addCallback(mkdir_p) - return d - def test_PUT_NEWDIRURL_mkdirs(self): d = self.PUT(self.public_url + "/foo/subdir/newdir?t=mkdir", "") d.addCallback(lambda res: diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 58fe7816..f99e1d8d 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -202,9 +202,6 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): d = self._POST_mkdir_with_children(req) elif t == "mkdir-immutable": d = self._POST_mkdir_immutable(req) - elif t == "mkdir-p": - # TODO: docs, tests - d = self._POST_mkdir_p(req) elif t == "upload": d = self._POST_upload(ctx) # this one needs the context elif t == "uri": @@ -286,32 +283,6 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): d.addCallback(lambda child: child.get_uri()) # TODO: urlencode return d - def _POST_mkdir_p(self, req): - path = get_arg(req, "path") - if not path: - raise WebError("mkdir-p requires a path") - path_ = tuple([seg.decode("utf-8") for seg in path.split('/') if seg ]) - # TODO: replace - d = self._get_or_create_directories(self.node, path_) - d.addCallback(lambda node: node.get_uri()) - return d - - def _get_or_create_directories(self, node, path): - if not IDirectoryNode.providedBy(node): - # unfortunately it is too late to provide the name of the - # blocking directory in the error message. - raise BlockingFileError("cannot create directory because there " - "is a file in the way") - if not path: - return defer.succeed(node) - d = node.get(path[0]) - def _maybe_create(f): - f.trap(NoSuchChildError) - return node.create_subdirectory(path[0]) - d.addErrback(_maybe_create) - d.addCallback(self._get_or_create_directories, path[1:]) - return d - def _POST_upload(self, ctx): req = IRequest(ctx) charset = get_arg(req, "_charset", "utf-8")