mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
web t=json: add 'mutable' key to the information dict
This commit is contained in:
parent
9c992c0d06
commit
3ac4a734e5
@ -298,6 +298,7 @@ GET /uri/$DIRCAP/[SUBDIRS../]FILENAME?t=json
|
||||
|
||||
[ "filenode", { "ro_uri": file_uri,
|
||||
"size": bytes,
|
||||
"mutable": false,
|
||||
"metadata": {"ctime": 1202777696.7564139,
|
||||
"mtime": 1202777696.7564139
|
||||
}
|
||||
@ -315,6 +316,7 @@ GET /uri/$DIRCAP/[SUBDIRS../]FILENAME?t=json
|
||||
|
||||
[ "dirnode", { "rw_uri": read_write_uri,
|
||||
"ro_uri": read_only_uri,
|
||||
"mutable": true,
|
||||
"children": {
|
||||
"foo.txt": [ "filenode", { "ro_uri": uri,
|
||||
"size": bytes,
|
||||
|
@ -183,6 +183,7 @@ class WebMixin(object):
|
||||
self.failUnless(isinstance(data, list))
|
||||
self.failUnlessEqual(data[0], "filenode")
|
||||
self.failUnless(isinstance(data[1], dict))
|
||||
self.failIf(data[1]["mutable"])
|
||||
self.failIf("rw_uri" in data[1]) # immutable
|
||||
self.failUnlessEqual(data[1]["ro_uri"], self._bar_txt_uri)
|
||||
self.failUnlessEqual(data[1]["size"], len(self.BAR_CONTENTS))
|
||||
@ -192,6 +193,7 @@ class WebMixin(object):
|
||||
self.failUnless(isinstance(data, list))
|
||||
self.failUnlessEqual(data[0], "dirnode", res)
|
||||
self.failUnless(isinstance(data[1], dict))
|
||||
self.failUnless(data[1]["mutable"])
|
||||
self.failUnless("rw_uri" in data[1]) # mutable
|
||||
self.failUnlessEqual(data[1]["rw_uri"], self._foo_uri)
|
||||
self.failUnlessEqual(data[1]["ro_uri"], self._foo_readonly_uri)
|
||||
@ -1150,6 +1152,7 @@ class Web(WebMixin, unittest.TestCase):
|
||||
self.failUnless("new.txt" in children)
|
||||
new_json = children["new.txt"]
|
||||
self.failUnlessEqual(new_json[0], "filenode")
|
||||
self.failUnless(new_json[1]["mutable"])
|
||||
self.failUnlessEqual(new_json[1]["rw_uri"], self._mutable_uri)
|
||||
ro_uri = unicode(self._mutable_node.get_readonly().to_string())
|
||||
self.failUnlessEqual(new_json[1]["ro_uri"], ro_uri)
|
||||
@ -1161,6 +1164,7 @@ class Web(WebMixin, unittest.TestCase):
|
||||
def _check_file_json(res):
|
||||
parsed = simplejson.loads(res)
|
||||
self.failUnlessEqual(parsed[0], "filenode")
|
||||
self.failUnless(parsed[1]["mutable"])
|
||||
self.failUnlessEqual(parsed[1]["rw_uri"], self._mutable_uri)
|
||||
ro_uri = unicode(self._mutable_node.get_readonly().to_string())
|
||||
self.failUnlessEqual(parsed[1]["ro_uri"], ro_uri)
|
||||
|
@ -645,6 +645,7 @@ def DirectoryJSONMetadata(ctx, dirnode):
|
||||
kiddata[1]["ro_uri"] = ro_uri
|
||||
if rw_uri:
|
||||
kiddata[1]["rw_uri"] = rw_uri
|
||||
kiddata[1]['mutable'] = childnode.is_mutable()
|
||||
kids[name] = kiddata
|
||||
if dirnode.is_readonly():
|
||||
drw_uri = None
|
||||
@ -657,6 +658,7 @@ def DirectoryJSONMetadata(ctx, dirnode):
|
||||
contents['ro_uri'] = dro_uri
|
||||
if drw_uri:
|
||||
contents['rw_uri'] = drw_uri
|
||||
contents['mutable'] = dirnode.is_mutable()
|
||||
data = ("dirnode", contents)
|
||||
return simplejson.dumps(data, indent=1)
|
||||
d.addCallback(_got)
|
||||
|
@ -380,6 +380,7 @@ def FileJSONMetadata(ctx, filenode):
|
||||
data[1]['ro_uri'] = ro_uri
|
||||
if rw_uri:
|
||||
data[1]['rw_uri'] = rw_uri
|
||||
data[1]['mutable'] = filenode.is_mutable()
|
||||
return text_plain(simplejson.dumps(data, indent=1), ctx)
|
||||
|
||||
def FileURI(ctx, filenode):
|
||||
|
Loading…
Reference in New Issue
Block a user