From 72adeccf2dc407f5788c2aebe8fd1e16b8ec3708 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 22 Jan 2009 21:44:49 -0700 Subject: [PATCH] dirnode: add get_repair_cap() --- src/allmydata/dirnode.py | 5 +++++ src/allmydata/test/test_dirnode.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index 3dde57a8..92e45bbe 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -226,6 +226,11 @@ class NewDirectoryNode: def get_verify_cap(self): return self._uri.get_verify_cap() + def get_repair_cap(self): + if self._node.is_readonly(): + return None + return self._uri + def get_storage_index(self): return self._uri._filenode_uri.storage_index diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index f0e51009..17fa9fee 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -297,6 +297,8 @@ class Dirnode(unittest.TestCase, self.failUnless(u_ro.startswith("URI:DIR2-RO:"), u_ro) u_v = n.get_verify_cap().to_string() self.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v) + u_r = n.get_repair_cap().to_string() + self.failUnlessEqual(u_r, u) self.expected_manifest.append( ((), u) ) self.expected_verifycaps.add(u_v) si = n.get_storage_index() -- 2.45.2