]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web/filenode: oops, fix test failures, not everything has a storage index
authorBrian Warner <warner@allmydata.com>
Wed, 29 Oct 2008 01:17:20 +0000 (18:17 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 29 Oct 2008 01:17:20 +0000 (18:17 -0700)
src/allmydata/test/common.py
src/allmydata/web/filenode.py

index 1898acc615dfb9da9438854e183c6e908a3d6526..d09ebff205470afbf866204f2bc83723a96656da 100644 (file)
@@ -46,6 +46,9 @@ class FakeCHKFileNode:
         return self.my_uri
     def get_verifier(self):
         return IURI(self.my_uri).get_verifier()
+    def get_storage_index(self):
+        return self.storage_index
+
     def check(self, monitor, verify=False):
         r = CheckerResults(self.storage_index)
         is_bad = self.bad_shares.get(self.storage_index, None)
index 472f782c329ff3d4b6aed2a4304612689418ded2..4c20079449e26471b73b82b4788725d1fb4aca58 100644 (file)
@@ -296,6 +296,8 @@ class MutableDownloadable:
         self.node = node
     def get_size(self):
         return self.size
+    def is_mutable(self):
+        return True
     def read(self, consumer, offset=0, size=None):
         d = self.node.download_best_version()
         d.addCallback(self._got_data, consumer, offset, size)
@@ -358,8 +360,11 @@ class FileDownloader(rend.Page):
             # TODO: look more closely at Request.setETag and how it interacts
             # with a conditional "if-etag-equals" request, I think this may
             # need to occur after the setResponseCode below
-            req.setETag(base32.b2a(self.filenode.get_storage_index()))
-            # TODO: for mutable files, use the roothash
+            si = self.filenode.get_storage_index()
+            if si:
+                req.setETag(base32.b2a(si))
+        # TODO: for mutable files, use the roothash. For LIT, hash the data.
+        # or maybe just use the URI for CHK and LIT.
         rangeheader = req.getHeader('range')
         if rangeheader:
             # adapted from nevow.static.File