mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
webapi: use all-caps "SDMF"/"MDMF" acronyms in t=json response
docs: upcase examples of t=json output and format= input
This commit is contained in:
parent
8b91410ebb
commit
01b00dc7dc
@ -379,8 +379,8 @@ Writing/Uploading A File
|
||||
immutable file, the "offset" parameter is not valid.
|
||||
|
||||
When creating a new file, you can control the type of file created by
|
||||
specifying a format= argument in the query string. format=mdmf creates an MDMF
|
||||
mutable file. format=sdmf creates an SDMF mutable file. format=chk creates an
|
||||
specifying a format= argument in the query string. format=MDMF creates an MDMF
|
||||
mutable file. format=SDMF creates an SDMF mutable file. format=CHK creates an
|
||||
immutable file. The value of the format argument is case-insensitive. For
|
||||
compatibility with previous versions of Tahoe-LAFS, the webapi will also
|
||||
accept a mutable=true argument in the query string. If mutable=true is given,
|
||||
@ -421,8 +421,8 @@ Creating A New Directory
|
||||
new code should use POST.
|
||||
|
||||
This supports a format= argument in the query string. The format=
|
||||
argument, if specified, controls the format of the directory. format=mdmf
|
||||
indicates that the directory should be stored as an MDMF file; format=sdmf
|
||||
argument, if specified, controls the format of the directory. format=MDMF
|
||||
indicates that the directory should be stored as an MDMF file; format=SDMF
|
||||
indicates that the directory should be stored as an SDMF file. The value of
|
||||
the format= argument is case-insensitive. If no format= argument is
|
||||
given, the directory's format is determined by the default mutable file
|
||||
@ -678,7 +678,7 @@ Getting Information About A File Or Directory (as JSON)
|
||||
"verify_uri": verify_uri,
|
||||
"size": bytes,
|
||||
"mutable": false,
|
||||
"format": "chk"
|
||||
"format": "CHK"
|
||||
} ]
|
||||
|
||||
If it is a capability to a directory followed by a path from that directory
|
||||
@ -692,7 +692,7 @@ Getting Information About A File Or Directory (as JSON)
|
||||
"verify_uri": verify_uri,
|
||||
"size": bytes,
|
||||
"mutable": false,
|
||||
"format": "chk",
|
||||
"format": "CHK",
|
||||
"metadata": {
|
||||
"ctime": 1202777696.7564139,
|
||||
"mtime": 1202777696.7564139,
|
||||
@ -716,7 +716,7 @@ Getting Information About A File Or Directory (as JSON)
|
||||
"ro_uri": read_only_uri,
|
||||
"verify_uri": verify_uri,
|
||||
"mutable": true,
|
||||
"format": "sdmf",
|
||||
"format": "SDMF",
|
||||
"children": {
|
||||
"foo.txt": [ "filenode",
|
||||
{
|
||||
|
@ -1145,7 +1145,7 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
def _check_mdmf_json(self, (rc, json, err)):
|
||||
self.failUnlessEqual(rc, 0)
|
||||
self.failUnlessEqual(err, "")
|
||||
self.failUnlessIn('"format": "mdmf"', json)
|
||||
self.failUnlessIn('"format": "MDMF"', json)
|
||||
# We also want a valid MDMF cap to be in the json.
|
||||
self.failUnlessIn("URI:MDMF", json)
|
||||
self.failUnlessIn("URI:MDMF-RO", json)
|
||||
@ -1154,7 +1154,7 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
def _check_sdmf_json(self, (rc, json, err)):
|
||||
self.failUnlessEqual(rc, 0)
|
||||
self.failUnlessEqual(err, "")
|
||||
self.failUnlessIn('"format": "sdmf"', json)
|
||||
self.failUnlessIn('"format": "SDMF"', json)
|
||||
# We also want to see the appropriate SDMF caps.
|
||||
self.failUnlessIn("URI:SSK", json)
|
||||
self.failUnlessIn("URI:SSK-RO", json)
|
||||
@ -1618,8 +1618,8 @@ class List(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
self.failUnlessIn(self._sdmf_uri, out)
|
||||
self.failUnlessIn(self._sdmf_readonly_uri, out)
|
||||
self.failUnlessIn(self._imm_uri, out)
|
||||
self.failUnlessIn('"format": "sdmf"', out)
|
||||
self.failUnlessIn('"format": "mdmf"', out)
|
||||
self.failUnlessIn('"format": "SDMF"', out)
|
||||
self.failUnlessIn('"format": "MDMF"', out)
|
||||
d.addCallback(_got_json)
|
||||
return d
|
||||
|
||||
@ -3318,7 +3318,7 @@ class Mkdir(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
d2.addCallback(lambda ign: self.do_cli("ls", "--json", dirname))
|
||||
d2.addCallback(_check, uri_prefix)
|
||||
d2.addCallback(lambda ign: self.do_cli("ls", "--json", self._filecap))
|
||||
d2.addCallback(_check, '"format": "%s"' % (mutable_type.lower(),))
|
||||
d2.addCallback(_check, '"format": "%s"' % (mutable_type.upper(),))
|
||||
return d2
|
||||
|
||||
d.addCallback(_mkdir, "sdmf", "URI:DIR2", "tahoe:foo")
|
||||
@ -3348,13 +3348,13 @@ class Mkdir(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
d.addCallback(_stash_dircap)
|
||||
d.addCallback(lambda res: self.do_cli("ls", "--json",
|
||||
self._filecap))
|
||||
d.addCallback(_check, '"format": "sdmf"')
|
||||
d.addCallback(_check, '"format": "SDMF"')
|
||||
d.addCallback(lambda res: self.do_cli("mkdir", "--mutable-type=mdmf"))
|
||||
d.addCallback(_check, "URI:DIR2-MDMF")
|
||||
d.addCallback(_stash_dircap)
|
||||
d.addCallback(lambda res: self.do_cli("ls", "--json",
|
||||
self._filecap))
|
||||
d.addCallback(_check, '"format": "mdmf"')
|
||||
d.addCallback(_check, '"format": "MDMF"')
|
||||
return d
|
||||
|
||||
def test_mkdir_bad_mutable_type(self):
|
||||
|
@ -1072,7 +1072,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
return filecap
|
||||
d.addCallback(_got_filecap)
|
||||
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
|
||||
d.addCallback(lambda json: self.failUnlessIn("mdmf", json))
|
||||
d.addCallback(lambda json: self.failUnlessIn("MDMF", json))
|
||||
return d
|
||||
|
||||
def test_PUT_NEWFILEURL_unlinked_sdmf(self):
|
||||
@ -1080,7 +1080,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
d = self.PUT("/uri?format=sdmf",
|
||||
contents)
|
||||
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
|
||||
d.addCallback(lambda json: self.failUnlessIn("sdmf", json))
|
||||
d.addCallback(lambda json: self.failUnlessIn("SDMF", json))
|
||||
return d
|
||||
|
||||
def test_PUT_NEWFILEURL_unlinked_bad_format(self):
|
||||
@ -1235,13 +1235,13 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
self.failUnlessIn("format", data)
|
||||
self.failUnlessEqual(data["format"], version)
|
||||
|
||||
d.addCallback(_got_json, "mdmf")
|
||||
d.addCallback(_got_json, "MDMF")
|
||||
# Now make an SDMF file and check that it is reported correctly.
|
||||
d.addCallback(lambda ignored:
|
||||
self.PUT("/uri?format=sdmf",
|
||||
self.NEWFILE_CONTENTS * 300000))
|
||||
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
|
||||
d.addCallback(_got_json, "sdmf")
|
||||
d.addCallback(_got_json, "SDMF")
|
||||
return d
|
||||
|
||||
def test_GET_FILEURL_json_mdmf(self):
|
||||
@ -1430,11 +1430,11 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
|
||||
mdmf_data = kids['mdmf.txt'][1]
|
||||
self.failUnlessIn("format", mdmf_data)
|
||||
self.failUnlessEqual(mdmf_data["format"], "mdmf")
|
||||
self.failUnlessEqual(mdmf_data["format"], "MDMF")
|
||||
|
||||
sdmf_data = kids['sdmf.txt'][1]
|
||||
self.failUnlessIn("format", sdmf_data)
|
||||
self.failUnlessEqual(sdmf_data["format"], "sdmf")
|
||||
self.failUnlessEqual(sdmf_data["format"], "SDMF")
|
||||
d.addCallback(_got_json)
|
||||
return d
|
||||
|
||||
@ -2141,7 +2141,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
data = simplejson.loads(json)
|
||||
data = data[1]
|
||||
self.failUnlessIn("format", data)
|
||||
self.failUnlessEqual(data["format"], format.lower())
|
||||
self.failUnlessEqual(data["format"], format.upper())
|
||||
d.addCallback(_got_json)
|
||||
return d
|
||||
d = defer.succeed(None)
|
||||
@ -2175,7 +2175,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
data = simplejson.loads(json)
|
||||
data = data[1]
|
||||
self.failUnlessIn("format", data)
|
||||
self.failUnlessEqual(data["format"], format.lower())
|
||||
self.failUnlessEqual(data["format"], format.upper())
|
||||
d.addCallback(_got_json)
|
||||
return d
|
||||
|
||||
@ -3468,7 +3468,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
data = simplejson.loads(json)
|
||||
data = data[1]
|
||||
self.failUnlessIn("format", data)
|
||||
self.failUnlessEqual(data["format"], "mdmf")
|
||||
self.failUnlessEqual(data["format"], "MDMF")
|
||||
self.failUnless(data['rw_uri'].startswith("URI:MDMF"))
|
||||
self.failUnless(data['ro_uri'].startswith("URI:MDMF"))
|
||||
d.addCallback(_got_json)
|
||||
@ -3485,7 +3485,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
data = simplejson.loads(json)
|
||||
data = data[1]
|
||||
self.failUnlessIn("format", data)
|
||||
self.failUnlessEqual(data["format"], "sdmf")
|
||||
self.failUnlessEqual(data["format"], "SDMF")
|
||||
d.addCallback(_got_json)
|
||||
return d
|
||||
|
||||
|
@ -869,11 +869,11 @@ def DirectoryJSONMetadata(ctx, dirnode):
|
||||
mutable_type = childnode.get_version()
|
||||
assert mutable_type in (SDMF_VERSION, MDMF_VERSION)
|
||||
if mutable_type == MDMF_VERSION:
|
||||
file_format = "mdmf"
|
||||
file_format = "MDMF"
|
||||
else:
|
||||
file_format = "sdmf"
|
||||
file_format = "SDMF"
|
||||
else:
|
||||
file_format = "chk"
|
||||
file_format = "CHK"
|
||||
kiddata[1]['format'] = file_format
|
||||
|
||||
elif IDirectoryNode.providedBy(childnode):
|
||||
|
@ -514,11 +514,11 @@ def FileJSONMetadata(ctx, filenode, edge_metadata):
|
||||
mutable_type = filenode.get_version()
|
||||
assert mutable_type in (SDMF_VERSION, MDMF_VERSION)
|
||||
if mutable_type == MDMF_VERSION:
|
||||
file_format = "mdmf"
|
||||
file_format = "MDMF"
|
||||
else:
|
||||
file_format = "sdmf"
|
||||
file_format = "SDMF"
|
||||
else:
|
||||
file_format = "chk"
|
||||
file_format = "CHK"
|
||||
data[1]['format'] = file_format
|
||||
|
||||
return text_plain(simplejson.dumps(data, indent=1) + "\n", ctx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user