self.failUnless(isinstance(data, list))
self.failUnlessEqual(data[0], "filenode")
self.failUnless(isinstance(data[1], dict))
- self.failUnlessEqual(data[1]["mutable"], False)
+ self.failIf("rw_uri" in data[1]) # immutable
+ self.failUnlessEqual(data[1]["ro_uri"], self._bar_txt_uri)
self.failUnlessEqual(data[1]["size"], 123)
- self.failUnlessEqual(data[1]["uri"], self._bar_txt_uri)
def failUnlessIsFooJSON(self, res):
data = self.worlds_cheapest_json_decoder(res)
self.failUnless(isinstance(data, list))
self.failUnlessEqual(data[0], "dirnode")
self.failUnless(isinstance(data[1], dict))
- self.failUnlessEqual(data[1]["mutable"], True)
- self.failUnlessEqual(data[1]["uri"], self._foo_uri)
+ 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)
kidnames = sorted(data[1]["children"].keys())
self.failUnlessEqual(kidnames,
["bar.txt", "blockingfile", "empty", "sub"])
self.failUnlessEqual(kids["sub"][0], "dirnode")
self.failUnlessEqual(kids["bar.txt"][0], "filenode")
self.failUnlessEqual(kids["bar.txt"][1]["size"], 123)
- self.failUnlessEqual(kids["bar.txt"][1]["uri"], self._bar_txt_uri)
+ self.failUnlessEqual(kids["bar.txt"][1]["ro_uri"], self._bar_txt_uri)
def GET(self, urlpath, followRedirect=False):
url = self.webish_url + urlpath
def renderNode(self, filenode):
file_uri = filenode.get_uri()
data = ("filenode",
- {'mutable': False,
- 'uri': file_uri,
+ {'ro_uri': file_uri,
'size': filenode.get_size(),
})
return simplejson.dumps(data, indent=1)
if IFileNode.providedBy(childnode):
kiduri = childnode.get_uri()
kiddata = ("filenode",
- {'mutable': False,
- 'uri': kiduri,
+ {'ro_uri': kiduri,
'size': childnode.get_size(),
})
else:
assert IDirectoryNode.providedBy(childnode)
- kiduri = childnode.get_uri()
kiddata = ("dirnode",
- {'mutable': childnode.is_mutable(),
- 'uri': kiduri,
+ {'ro_uri': childnode.get_immutable_uri(),
})
+ if childnode.is_mutable():
+ kiddata[1]['rw_uri'] = childnode.get_uri()
kids[name] = kiddata
contents = { 'children': kids,
- 'mutable': node.is_mutable(),
- 'uri': node.get_uri(),
+ 'ro_uri': node.get_immutable_uri(),
}
+ if node.is_mutable():
+ contents['rw_uri'] = node.get_uri()
data = ("dirnode", contents)
return simplejson.dumps(data, indent=1)
d.addCallback(_got)