GET /uri/$DIRCAP/[SUBDIRS../]FILENAME?t=json :
[ "filenode", { "ro_uri": file_uri,
+ "verify_uri": verify_uri,
"size": bytes,
"mutable": false,
"metadata": {"ctime": 1202777696.7564139,
[ "dirnode", { "rw_uri": read_write_uri,
"ro_uri": read_only_uri,
+ "verify_uri": verify_uri,
"mutable": true,
"children": {
"foo.txt": [ "filenode", { "ro_uri": uri,
that is stored on the directory edge).
Then the rw_uri field will be present in the information about a directory
- if and only if you have read-write access to that directory,
+ if and only if you have read-write access to that directory. The verify_uri
+ field will be presend if and only if the object has a verify-cap
+ (non-distributed LIT files do not have verify-caps).
=== Attaching an existing File or Directory by its read- or write- cap ===
return self.my_uri.get_readonly()
def get_readonly_uri(self):
return self.my_uri.get_readonly().to_string()
+ def get_verify_cap(self):
+ return self.my_uri.get_verify_cap()
def is_readonly(self):
return self.my_uri.is_readonly()
def is_mutable(self):
self._foo_node = foo
self._foo_uri = foo.get_uri()
self._foo_readonly_uri = foo.get_readonly_uri()
+ self._foo_verifycap = foo.get_verify_cap().to_string()
# NOTE: we ignore the deferred on all set_uri() calls, because we
# know the fake nodes do these synchronously
self.public_root.set_uri(u"foo", foo.get_uri())
self.BAR_CONTENTS, n, self._bar_txt_uri = self.makefile(0)
foo.set_uri(u"bar.txt", self._bar_txt_uri)
+ self._bar_txt_verifycap = n.get_verify_cap().to_string()
foo.set_uri(u"empty", res[3][1].get_uri())
sub_uri = res[4][1].get_uri()
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]["verify_uri"], self._bar_txt_verifycap)
self.failUnlessEqual(data[1]["size"], len(self.BAR_CONTENTS))
def failUnlessIsFooJSON(self, res):
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)
+ self.failUnlessEqual(data[1]["verify_uri"], self._foo_verifycap)
kidnames = sorted([unicode(n) for n in data[1]["children"]])
self.failUnlessEqual(kidnames,
self.failUnlessEqual(kids[u"bar.txt"][0], "filenode")
self.failUnlessEqual(kids[u"bar.txt"][1]["size"], len(self.BAR_CONTENTS))
self.failUnlessEqual(kids[u"bar.txt"][1]["ro_uri"], self._bar_txt_uri)
+ self.failUnlessEqual(kids[u"bar.txt"][1]["verify_uri"],
+ self._bar_txt_verifycap)
self.failUnlessEqual(kids[u"bar.txt"][1]["metadata"]["ctime"],
self._bar_txt_metadata["ctime"])
self.failUnlessEqual(kids[u"n\u00fc.txt"][1]["ro_uri"],
kiddata[1]["ro_uri"] = ro_uri
if rw_uri:
kiddata[1]["rw_uri"] = rw_uri
+ verifycap = childnode.get_verify_cap()
+ if verifycap:
+ kiddata[1]['verify_uri'] = verifycap.to_string()
kiddata[1]['mutable'] = childnode.is_mutable()
kids[name] = kiddata
if dirnode.is_readonly():
contents['ro_uri'] = dro_uri
if drw_uri:
contents['rw_uri'] = drw_uri
+ verifycap = dirnode.get_verify_cap()
+ if verifycap:
+ contents['verify_uri'] = verifycap.to_string()
contents['mutable'] = dirnode.is_mutable()
data = ("dirnode", contents)
return simplejson.dumps(data, indent=1) + "\n"
data[1]['ro_uri'] = ro_uri
if rw_uri:
data[1]['rw_uri'] = rw_uri
+ verifycap = filenode.get_verify_cap()
+ if verifycap:
+ data[1]['verify_uri'] = verifycap.to_string()
data[1]['mutable'] = filenode.is_mutable()
return text_plain(simplejson.dumps(data, indent=1) + "\n", ctx)