From fec9185f2a866523a6b1046dab74553fc611e9b2 Mon Sep 17 00:00:00 2001 From: david-sarah <david-sarah@jacaranda.org> Date: Sun, 21 Feb 2010 19:36:52 -0800 Subject: [PATCH] Additional fix for abbrev_si, with test --- src/allmydata/test/test_uri.py | 2 ++ src/allmydata/uri.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/test_uri.py b/src/allmydata/test/test_uri.py index d5d260b9..f6254eb4 100644 --- a/src/allmydata/test/test_uri.py +++ b/src/allmydata/test/test_uri.py @@ -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>") diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index c69ed147..9dd5a562 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -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 -- 2.45.2