mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
Patch to accept t=set-children as well as t=set_children
This commit is contained in:
parent
584c0ed487
commit
5c5a6fe610
@ -666,6 +666,7 @@ PUT /uri/$DIRCAP/[SUBDIRS../]CHILDNAME?t=uri
|
||||
=== Adding multiple files or directories to a parent directory at once ===
|
||||
|
||||
POST /uri/$DIRCAP/[SUBDIRS..]?t=set_children
|
||||
POST /uri/$DIRCAP/[SUBDIRS..]?t=set-children (Tahoe >= v1.6)
|
||||
|
||||
This command adds multiple children to a directory in a single operation.
|
||||
It reads the request body and interprets it as a JSON-encoded description
|
||||
@ -695,6 +696,11 @@ POST /uri/$DIRCAP/[SUBDIRS..]?t=set_children
|
||||
the section above entitled "Get Information About A File Or Directory (as
|
||||
JSON)", in the "About the metadata" subsection.
|
||||
|
||||
Note that this command was introduced with the name "set_children", which
|
||||
uses an underscore rather than a hyphen as other multi-word command names
|
||||
do. The variant with a hyphen is now accepted, but clients that desire
|
||||
backward compatibility should continue to use "set_children".
|
||||
|
||||
|
||||
=== Deleting a File or Directory ===
|
||||
|
||||
|
@ -2236,7 +2236,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
|
||||
self.POST, self.public_url + "/foo", t="BOGUS")
|
||||
return d
|
||||
|
||||
def test_POST_set_children(self):
|
||||
def test_POST_set_children(self, command_name="set_children"):
|
||||
contents9, n9, newuri9 = self.makefile(9)
|
||||
contents10, n10, newuri10 = self.makefile(10)
|
||||
contents11, n11, newuri11 = self.makefile(11)
|
||||
@ -2265,7 +2265,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
|
||||
} ]
|
||||
}""" % (newuri9, newuri10, newuri11)
|
||||
|
||||
url = self.webish_url + self.public_url + "/foo" + "?t=set_children"
|
||||
url = self.webish_url + self.public_url + "/foo" + "?t=" + command_name
|
||||
|
||||
d = client.getPage(url, method="POST", postdata=reqbody)
|
||||
def _then(res):
|
||||
@ -2277,6 +2277,9 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
|
||||
d.addErrback(self.dump_error)
|
||||
return d
|
||||
|
||||
def test_POST_set_children_with_hyphen(self):
|
||||
return self.test_POST_set_children(command_name="set-children")
|
||||
|
||||
def test_POST_put_uri(self):
|
||||
contents, n, newuri = self.makefile(8)
|
||||
d = self.POST(self.public_url + "/foo", t="uri", name="new.txt", uri=newuri)
|
||||
|
@ -220,7 +220,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
|
||||
d = self._POST_start_deep_stats(ctx)
|
||||
elif t == "stream-manifest":
|
||||
d = self._POST_stream_manifest(ctx)
|
||||
elif t == "set_children":
|
||||
elif t == "set_children" or t == "set-children":
|
||||
d = self._POST_set_children(req)
|
||||
else:
|
||||
raise WebError("POST to a directory with bad t=%s" % t)
|
||||
|
Loading…
Reference in New Issue
Block a user