From: Brian Warner Date: Sat, 31 Jan 2009 02:31:10 +0000 (-0700) Subject: uri: add abbrev_si() method, which returns the abbreviated storage index X-Git-Tag: allmydata-tahoe-1.3.0~112 X-Git-Url: https://git.rkrishnan.org/simplejson/frontends?a=commitdiff_plain;h=b77a017872c79a80aefed6667bc6c6f0c7b37e4c;p=tahoe-lafs%2Ftahoe-lafs.git uri: add abbrev_si() method, which returns the abbreviated storage index --- diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 3228ae81..776a7b74 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -232,6 +232,8 @@ class WriteableSSKFileURI(_BaseURI): def abbrev(self): return base32.b2a(self.writekey[:5]) + def abbrev_si(self): + return base32.b2a(self.storage_index)[:5] def is_readonly(self): return False @@ -278,6 +280,8 @@ class ReadonlySSKFileURI(_BaseURI): def abbrev(self): return base32.b2a(self.readkey[:5]) + def abbrev_si(self): + return base32.b2a(self.storage_index)[:5] def is_readonly(self): return True @@ -355,6 +359,8 @@ class _NewDirectoryBaseURI(_BaseURI): def abbrev(self): return self._filenode_uri.to_string().split(':')[2][:5] + def abbrev_si(self): + return base32.b2a(self._filenode_uri.storage_index)[:5] def get_filenode_uri(self): return self._filenode_uri