]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Additional fix for abbrev_si, with test
authordavid-sarah <david-sarah@jacaranda.org>
Mon, 22 Feb 2010 03:36:52 +0000 (19:36 -0800)
committerdavid-sarah <david-sarah@jacaranda.org>
Mon, 22 Feb 2010 03:36:52 +0000 (19:36 -0800)
src/allmydata/test/test_uri.py
src/allmydata/uri.py

index d5d260b9e50d2503da69ffe6f255049b45b6c06a..f6254eb41615206ef50e89a13b6e1b340c7ce3c8 100644 (file)
@@ -470,3 +470,5 @@ class Dirnode(unittest.TestCase):
         self.failIf(IFileURI.providedBy(u1))
         self.failUnless(IDirnodeURI.providedBy(u1))
         self.failUnlessEqual(u1.get_verify_cap(), None)
+        self.failUnlessEqual(u1.get_storage_index(), None)
+        self.failUnlessEqual(u1.abbrev_si(), "<LIT>")
index c69ed14782804ccb8227c25604cc307125f2de5e..9dd5a5628463f15a592d6e33bce73c5251c84d6a 100644 (file)
@@ -434,7 +434,10 @@ class _DirectoryBaseURI(_BaseURI):
         return self._filenode_uri.to_string().split(':')[2][:5]
 
     def abbrev_si(self):
-        return base32.b2a(self._filenode_uri.get_storage_index())[:5]
+        si = self._filenode_uri.get_storage_index()
+        if si is None:
+            return "<LIT>"
+        return base32.b2a(si)[:5]
 
     def is_mutable(self):
         return True