From: Brian Warner Date: Wed, 14 Mar 2012 23:36:40 +0000 (-0700) Subject: IServer.get_name(): remove v0- prefix from displayed server names X-Git-Url: https://git.rkrishnan.org/pf/content/en/%3C?a=commitdiff_plain;h=890449801e4cf7a015108c5a72a2fae57b18c6d2;p=tahoe-lafs%2Ftahoe-lafs.git IServer.get_name(): remove v0- prefix from displayed server names Don't remove the prefix if it isn't there: that avoids the need to fix tests which use a bogus key (usually all-zeros). --- diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index 9d36a8bd..72e6319a 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -190,9 +190,16 @@ class NativeStorageServer: ps = base32.a2b(str(ann["permutation-seed-base32"])) self._permutation_seed = ps - name = key_s or tubid_s - self._long_description = name - self._short_description = name[:8] # TODO: decide who adds [] + if key_s: + self._long_description = key_s + if key_s.startswith("v0-"): + # remove v0- prefix from abbreviated name + self._short_description = key_s[3:3+8] + else: + self._short_description = key_s[:8] + else: + self._long_description = tubid_s + self._short_description = tubid_s[:8] self.announcement_time = time.time() self.last_connect_time = None @@ -213,6 +220,8 @@ class NativeStorageServer: return self.rref.version return None def get_name(self): # keep methodname short + # TODO: decide who adds [] in the short description. It should + # probably be the output side, not here. return self._short_description def get_longname(self): return self._long_description