]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Patch to accept t=set-children as well as t=set_children
authordavid-sarah <david-sarah@jacaranda.org>
Sun, 24 Jan 2010 03:00:20 +0000 (19:00 -0800)
committerdavid-sarah <david-sarah@jacaranda.org>
Sun, 24 Jan 2010 03:00:20 +0000 (19:00 -0800)
docs/frontends/webapi.txt
src/allmydata/test/test_web.py
src/allmydata/web/directory.py

index e955933b2715da1ff417de005883817fafae4925..a16ccc5ce0995fe32414bb2665d9e489bd50af3f 100644 (file)
@@ -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
@@ -694,6 +695,11 @@ POST /uri/$DIRCAP/[SUBDIRS..]?t=set_children
   currently placed here are "linkcrtime" and "linkmotime". For details, see
   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 ===
index d4f4bb536008dedcc86a8bb984c913f782aaaa2f..1829f09311e5b12f96112d43091ea5f83f2d015d 100644 (file)
@@ -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)
index fe5b0462985fb73e933b573d3876818cd264f2ce..299421f1fffcc24553ab330021a35667472cf0eb 100644 (file)
@@ -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)