]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
switch UploadResults to use get_uri(), hide internal ._uri
authorBrian Warner <warner@lothar.com>
Tue, 22 May 2012 04:14:44 +0000 (21:14 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 22 May 2012 04:14:44 +0000 (21:14 -0700)
Complete the getter-based transformation, by hiding ".uri" and updating
callers to use get_uri(). Also don't set a dummy self._uri, leave it
undefined until someone calls set_uri().

18 files changed:
src/allmydata/control.py
src/allmydata/dirnode.py
src/allmydata/immutable/upload.py
src/allmydata/interfaces.py
src/allmydata/nodemaker.py
src/allmydata/test/test_checker.py
src/allmydata/test/test_cli.py
src/allmydata/test/test_download.py
src/allmydata/test/test_encode.py
src/allmydata/test/test_helper.py
src/allmydata/test/test_hung_server.py
src/allmydata/test/test_immutable.py
src/allmydata/test/test_no_network.py
src/allmydata/test/test_repairer.py
src/allmydata/test/test_system.py
src/allmydata/test/test_upload.py
src/allmydata/test/test_web.py
src/allmydata/web/unlinked.py

index fcde8fabaa0620092fd1bd87f71e3074a10451d0..15ab382d6ecad26b4ca93564ec5b267efe32d6ee 100644 (file)
@@ -64,7 +64,7 @@ class ControlServer(Referenceable, service.Service):
         uploader = self.parent.getServiceNamed("uploader")
         u = upload.FileName(filename, convergence=convergence)
         d = uploader.upload(u)
-        d.addCallback(lambda results: results.uri)
+        d.addCallback(lambda results: results.get_uri())
         return d
 
     def remote_download_from_uri_to_file(self, uri, filename):
@@ -186,7 +186,7 @@ class SpeedTest:
             else:
                 up = upload.FileName(fn, convergence=None)
                 d1 = self.parent.upload(up)
-                d1.addCallback(lambda results: results.uri)
+                d1.addCallback(lambda results: results.get_uri())
             d1.addCallback(_record_uri, i)
             d1.addCallback(_upload_one_file, i+1)
             return d1
index b0bb72d2ed98cf85bfacf2d36a148584366dd824..7941e623abfa389a16709f7d2205eb0f17017252 100644 (file)
@@ -597,7 +597,8 @@ class DirectoryNode:
             return defer.fail(NotWriteableError())
         d = self._uploader.upload(uploadable)
         d.addCallback(lambda results:
-                      self._create_and_validate_node(results.uri, None, name))
+                      self._create_and_validate_node(results.get_uri(), None,
+                                                     name))
         d.addCallback(lambda node:
                       self.set_node(name, node, metadata, overwrite))
         return d
index bfd613454daa305c8172b6273793c8db8d9fb696..81f18a8fe256795a32daad4c7eab19957e531fb5 100644 (file)
@@ -80,13 +80,14 @@ class UploadResults:
         self._uri_extension_data = uri_extension_data
         self._uri_extension_hash = uri_extension_hash
         self._verifycapstr = verifycapstr
-        self.uri = None
 
     def set_uri(self, uri):
-        self.uri = uri
+        self._uri = uri
 
     def get_file_size(self):
         return self._file_size
+    def get_uri(self):
+        return self._uri
     def get_ciphertext_fetched(self):
         return self._ciphertext_fetched
     def get_preexisting_shares(self):
index bac3df275235f649e568dcc15b2cf891c9ae8847..93063d3c503d80ebec1ad6a5e58e2c6cb7b8fed0 100644 (file)
@@ -1930,14 +1930,13 @@ class IUploadResults(Interface):
     """I am returned by immutable upload() methods and contain the results of
     the upload.
 
-    I contain one public attribute:
-     .uri : the CHK read-cap for the file
-    """
+    Note that some of my methods return empty values (0 or an empty dict)
+    when called for non-distributed LIT files."""
 
-    # some methods return empty values (0 or an empty dict) when called for
-    # non-distributed LIT files
     def get_file_size():
         """Return the file size, in bytes."""
+    def get_uri():
+        """Return the (string) URI of the object uploaded, a CHK readcap."""
     def get_ciphertext_fetched():
         """Return the number of bytes fetched by the helpe for this upload,
         or 0 if the helper did not need to fetch any bytes (or if there was
index d0c9b4b69b199df1f4601b8687044664ea0ae48a..c820c71ca1732a8ced1d8397be55c6e5685c3b5d 100644 (file)
@@ -139,6 +139,7 @@ class NodeMaker:
         packed = pack_children(children, None, deep_immutable=True)
         uploadable = Data(packed, convergence)
         d = self.uploader.upload(uploadable)
-        d.addCallback(lambda results: self.create_from_cap(None, results.uri))
+        d.addCallback(lambda results:
+                      self.create_from_cap(None, results.get_uri()))
         d.addCallback(self._create_dirnode)
         return d
index f6e604778b9c15756600c1844a3c2b4f503e1a50..f88ba5c214eaf78d8e0feb16ebc972ea908be821 100644 (file)
@@ -347,7 +347,7 @@ class BalancingAct(GridTestMixin, unittest.TestCase):
         DATA = "data" * 100
         d = c0.upload(Data(DATA, convergence=""))
         def _stash_immutable(ur):
-            self.imm = c0.create_node_from_uri(ur.uri)
+            self.imm = c0.create_node_from_uri(ur.get_uri())
             self.uri = self.imm.get_uri()
         d.addCallback(_stash_immutable)
         d.addCallback(lambda ign:
@@ -404,7 +404,7 @@ class AddLease(GridTestMixin, unittest.TestCase):
         DATA = "data" * 100
         d = c0.upload(Data(DATA, convergence=""))
         def _stash_immutable(ur):
-            self.imm = c0.create_node_from_uri(ur.uri)
+            self.imm = c0.create_node_from_uri(ur.get_uri())
         d.addCallback(_stash_immutable)
         d.addCallback(lambda ign:
             c0.create_mutable_file(MutableData("contents")))
@@ -497,7 +497,7 @@ class TooParallel(GridTestMixin, unittest.TestCase):
             return self.c0.upload(Data(DATA, convergence=""))
         d.addCallback(_start)
         def _do_check(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             return n.check(Monitor(), verify=True)
         d.addCallback(_do_check)
         def _check(cr):
index 5aa58786fba4331cb02ac3805568b1164ef7eb53..c88d00b3ae16c7a6c9334d90c5a1e389b5729d8d 100644 (file)
@@ -3247,8 +3247,8 @@ class Errors(GridTestMixin, CLITestMixin, unittest.TestCase):
         DATA = "data" * 100
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _stash_bad(ur):
-            self.uri_1share = ur.uri
-            self.delete_shares_numbered(ur.uri, range(1,10))
+            self.uri_1share = ur.get_uri()
+            self.delete_shares_numbered(ur.get_uri(), range(1,10))
         d.addCallback(_stash_bad)
 
         # the download is abandoned as soon as it's clear that we won't get
index a155182279ccccebac05b304faa3826241c504cb..710d98ed1432c98777552eaed33005637042b25f 100644 (file)
@@ -87,9 +87,9 @@ class _Base(GridTestMixin, ShouldFailMixin):
         def _created_immutable(ur):
             # write the generated shares and URI to a file, which can then be
             # incorporated into this one next time.
-            f.write('immutable_uri = "%s"\n' % ur.uri)
+            f.write('immutable_uri = "%s"\n' % ur.get_uri())
             f.write('immutable_shares = {\n')
-            si = uri.from_string(ur.uri).get_storage_index()
+            si = uri.from_string(ur.get_uri()).get_storage_index()
             si_dir = storage_index_to_dir(si)
             for (i,ss,ssdir) in self.iterate_servers():
                 sharedir = os.path.join(ssdir, "shares", si_dir)
@@ -284,7 +284,7 @@ class DownloadTest(_Base, unittest.TestCase):
         u.max_segment_size = 70 # 5 segs
         d = self.c0.upload(u)
         def _uploaded(ur):
-            self.uri = ur.uri
+            self.uri = ur.get_uri()
             self.n = self.c0.create_node_from_uri(self.uri)
             return download_to_data(self.n)
         d.addCallback(_uploaded)
@@ -372,7 +372,7 @@ class DownloadTest(_Base, unittest.TestCase):
         con2 = MemoryConsumer()
         d = self.c0.upload(u)
         def _uploaded(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             d1 = n.read(con1, 70, 20)
             d2 = n.read(con2, 140, 20)
             return defer.gatherResults([d1,d2])
@@ -397,7 +397,7 @@ class DownloadTest(_Base, unittest.TestCase):
         con2 = MemoryConsumer()
         d = self.c0.upload(u)
         def _uploaded(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
             d1 = n.read(con1, 70, 20)
@@ -425,7 +425,7 @@ class DownloadTest(_Base, unittest.TestCase):
         con2 = MemoryConsumer()
         d = self.c0.upload(u)
         def _uploaded(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
             d = n.read(con1, 12000, 20)
@@ -515,8 +515,8 @@ class DownloadTest(_Base, unittest.TestCase):
             def _corruptor(s, debug=False):
                 which = 48 # first byte of block0
                 return s[:which] + chr(ord(s[which])^0x01) + s[which+1:]
-            self.corrupt_all_shares(ur.uri, _corruptor)
-            n = self.c0.create_node_from_uri(ur.uri)
+            self.corrupt_all_shares(ur.get_uri(), _corruptor)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
             con1 = MemoryConsumer()
@@ -556,8 +556,8 @@ class DownloadTest(_Base, unittest.TestCase):
             def _corruptor(s, debug=False):
                 which = 48 # first byte of block0
                 return s[:which] + chr(ord(s[which])^0x01) + s[which+1:]
-            self.corrupt_all_shares(ur.uri, _corruptor)
-            n = self.c0.create_node_from_uri(ur.uri)
+            self.corrupt_all_shares(ur.get_uri(), _corruptor)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
             con1 = MemoryConsumer()
@@ -771,7 +771,7 @@ class DownloadTest(_Base, unittest.TestCase):
         u.max_segment_size = 60 # 6 segs
         d = self.c0.upload(u)
         def _uploaded(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
 
@@ -810,7 +810,7 @@ class DownloadTest(_Base, unittest.TestCase):
         con2 = MemoryConsumer()
         d = self.c0.upload(u)
         def _uploaded(ur):
-            n = self.c0.create_node_from_uri(ur.uri)
+            n = self.c0.create_node_from_uri(ur.get_uri())
             n._cnode._maybe_create_download_node()
             n._cnode._node._build_guessed_tables(u.max_segment_size)
             d1 = n.read(con1, 70, 20)
@@ -1002,7 +1002,7 @@ class Corruption(_Base, unittest.TestCase):
 
         d = self.c0.upload(u)
         def _uploaded(ur):
-            imm_uri = ur.uri
+            imm_uri = ur.get_uri()
             self.shares = self.copy_shares(imm_uri)
             d = defer.succeed(None)
             # 'victims' is a list of corruption tests to run. Each one flips
@@ -1099,7 +1099,7 @@ class Corruption(_Base, unittest.TestCase):
 
         d = self.c0.upload(u)
         def _uploaded(ur):
-            imm_uri = ur.uri
+            imm_uri = ur.get_uri()
             self.shares = self.copy_shares(imm_uri)
 
             corrupt_me = [(48, "block data", "Last failure: None"),
@@ -1159,7 +1159,7 @@ class DownloadV2(_Base, unittest.TestCase):
         u = upload.Data(plaintext, None)
         d = self.c0.upload(u)
         def _uploaded(ur):
-            imm_uri = ur.uri
+            imm_uri = ur.get_uri()
             n = self.c0.create_node_from_uri(imm_uri)
             return download_to_data(n)
         d.addCallback(_uploaded)
@@ -1182,7 +1182,7 @@ class DownloadV2(_Base, unittest.TestCase):
         u = upload.Data(plaintext, None)
         d = self.c0.upload(u)
         def _uploaded(ur):
-            imm_uri = ur.uri
+            imm_uri = ur.get_uri()
             n = self.c0.create_node_from_uri(imm_uri)
             return download_to_data(n)
         d.addCallback(_uploaded)
@@ -1202,7 +1202,7 @@ class DownloadV2(_Base, unittest.TestCase):
         u = upload.Data(plaintext, None)
         d = self.c0.upload(u)
         def _uploaded(ur):
-            imm_uri = ur.uri
+            imm_uri = ur.get_uri()
             def _do_corrupt(which, newvalue):
                 def _corruptor(s, debug=False):
                     return s[:which] + chr(newvalue) + s[which+1:]
index c06fbbd3e165067200c0bd88e4dc0a50c23bbff5..91c2ece9c5973247cc53eff113dcb24b19e8da90 100644 (file)
@@ -395,7 +395,7 @@ class Roundtrip(GridTestMixin, unittest.TestCase):
         u.encoding_param_happy = 1
         u.encoding_param_n = 100
         d = self.c0.upload(u)
-        d.addCallback(lambda ur: self.c0.create_node_from_uri(ur.uri))
+        d.addCallback(lambda ur: self.c0.create_node_from_uri(ur.get_uri()))
         # returns a FileNode
         return d
 
index 6ba7b7e64c3995286024b8c9291789be0c83ea3f..909e3e5df894b619253134adafc5b9621013e399 100644 (file)
@@ -155,7 +155,7 @@ class AssistedUpload(unittest.TestCase):
             return upload_data(u, DATA, convergence="some convergence string")
         d.addCallback(_ready)
         def _uploaded(results):
-            the_uri = results.uri
+            the_uri = results.get_uri()
             assert "CHK" in the_uri
         d.addCallback(_uploaded)
 
@@ -205,7 +205,7 @@ class AssistedUpload(unittest.TestCase):
             return upload_data(u, DATA, convergence="test convergence string")
         d.addCallback(_ready)
         def _uploaded(results):
-            the_uri = results.uri
+            the_uri = results.get_uri()
             assert "CHK" in the_uri
         d.addCallback(_uploaded)
 
@@ -232,7 +232,7 @@ class AssistedUpload(unittest.TestCase):
             return upload_data(u, DATA, convergence="some convergence string")
         d.addCallback(_ready)
         def _uploaded(results):
-            the_uri = results.uri
+            the_uri = results.get_uri()
             assert "CHK" in the_uri
         d.addCallback(_uploaded)
 
index 776135dc316fff99aeb65250ca38269e5112f394..e2d6f6a1dda96ef2f6faa8fd38aca74c4e74ecb3 100644 (file)
@@ -117,7 +117,7 @@ class HungServerDownloadTest(GridTestMixin, ShouldFailMixin, PollMixin,
             data = upload.Data(immutable_plaintext, convergence="")
             d = self.c0.upload(data)
             def _uploaded_immutable(upload_res):
-                self.uri = upload_res.uri
+                self.uri = upload_res.get_uri()
                 self.shares = self.find_uri_shares(self.uri)
             d.addCallback(_uploaded_immutable)
         return d
index f1e0c7b2dd96ca33921898ff1c8bf3f2030a0e16..963cedae03dc97d48bd95fe1796d0d011dd0c3aa 100644 (file)
@@ -146,8 +146,8 @@ class Test(GridTestMixin, unittest.TestCase, common.ShouldFailMixin):
         c1.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
         d = c1.upload(Data(TEST_DATA, convergence=""))
         def _after_upload(ur):
-            self.uri = ur.uri
-            self.filenode = self.g.clients[0].create_node_from_uri(ur.uri)
+            self.uri = ur.get_uri()
+            self.filenode = self.g.clients[0].create_node_from_uri(ur.get_uri())
             return self.uri
         d.addCallback(_after_upload)
         return d
index ef7eed5cafb2cba80418328f3fdb7bb9d01f4e15..345662f7da9f29bfac7a1935508cc6b0112d510b 100644 (file)
@@ -31,7 +31,7 @@ class Harness(unittest.TestCase):
         data = Data(DATA, "")
         d = c0.upload(data)
         def _uploaded(res):
-            n = c0.create_node_from_uri(res.uri)
+            n = c0.create_node_from_uri(res.get_uri())
             return download_to_data(n)
         d.addCallback(_uploaded)
         def _check(res):
index 168d84c2e5c4536a330587b5efed59765e6e24f0..65d2b2c27669810f207598a10ed62e233d5003f3 100644 (file)
@@ -62,9 +62,9 @@ class RepairTestMixin:
         c0.DEFAULT_ENCODING_PARAMETERS['max_segment_size'] = 12
         d = c0.upload(upload.Data(common.TEST_DATA, convergence=""))
         def _stash_uri(ur):
-            self.uri = ur.uri
-            self.c0_filenode = c0.create_node_from_uri(ur.uri)
-            self.c1_filenode = c1.create_node_from_uri(ur.uri)
+            self.uri = ur.get_uri()
+            self.c0_filenode = c0.create_node_from_uri(ur.get_uri())
+            self.c1_filenode = c1.create_node_from_uri(ur.get_uri())
         d.addCallback(_stash_uri)
         return d
 
@@ -690,9 +690,9 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin,
         c0.DEFAULT_ENCODING_PARAMETERS['n'] = 66
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _then(ur):
-            self.uri = ur.uri
+            self.uri = ur.get_uri()
             self.delete_shares_numbered(self.uri, [0])
-            self.c0_filenode = c0.create_node_from_uri(ur.uri)
+            self.c0_filenode = c0.create_node_from_uri(ur.get_uri())
             self._stash_counts()
             return self.c0_filenode.check_and_repair(Monitor())
         d.addCallback(_then)
index 4a8e40617b8fbbeaa5325b6cb56284a4a204d38f..f3b72f53ba07f0d76727b3b482eb365e8599fd6a 100644 (file)
@@ -122,7 +122,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
             return d1
         d.addCallback(_do_upload)
         def _upload_done(results):
-            theuri = results.uri
+            theuri = results.get_uri()
             log.msg("upload finished: uri is %s" % (theuri,))
             self.uri = theuri
             assert isinstance(self.uri, str), self.uri
@@ -218,7 +218,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
             u = upload.Data(HELPER_DATA, convergence=convergence)
             d = self.extra_node.upload(u)
             def _uploaded(results):
-                n = self.clients[1].create_node_from_uri(results.uri)
+                n = self.clients[1].create_node_from_uri(results.get_uri())
                 return download_to_data(n)
             d.addCallback(_uploaded)
             def _check(newdata):
@@ -232,7 +232,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
             u.debug_stash_RemoteEncryptedUploadable = True
             d = self.extra_node.upload(u)
             def _uploaded(results):
-                n = self.clients[1].create_node_from_uri(results.uri)
+                n = self.clients[1].create_node_from_uri(results.get_uri())
                 return download_to_data(n)
             d.addCallback(_uploaded)
             def _check(newdata):
@@ -320,7 +320,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
             d.addCallback(lambda res: self.extra_node.upload(u2))
 
             def _uploaded(results):
-                cap = results.uri
+                cap = results.get_uri()
                 log.msg("Second upload complete", level=log.NOISY,
                         facility="tahoe.test.test_system")
 
index 99116de421aeebae53ef4533a91afa2dd83ce910..6a83f580d9c614dbbc78de1a31f2da178ed2688c 100644 (file)
@@ -24,7 +24,7 @@ from allmydata.storage.server import storage_index_to_dir
 MiB = 1024*1024
 
 def extract_uri(results):
-    return results.uri
+    return results.get_uri()
 
 # Some of these took longer than 480 seconds on Zandr's arm box, but this may
 # have been due to an earlier test ERROR'ing out due to timeout, which seems
@@ -863,7 +863,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin,
         self.data = data
         d = client.upload(data)
         def _store_uri(ur):
-            self.uri = ur.uri
+            self.uri = ur.get_uri()
         d.addCallback(_store_uri)
         d.addCallback(lambda ign:
             self.find_uri_shares(self.uri))
@@ -881,7 +881,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin,
         DATA = "data" * 100
         u = upload.Data(DATA, convergence="")
         d = c0.upload(u)
-        d.addCallback(lambda ur: c0.create_node_from_uri(ur.uri))
+        d.addCallback(lambda ur: c0.create_node_from_uri(ur.get_uri()))
         m = monitor.Monitor()
         d.addCallback(lambda fn: fn.check(m))
         def _check(cr):
index dddc501ca41c35e02f2198eb947d6a52bdbf3684..ca3c85f01355f4f316f10767dd999df934234ac6 100644 (file)
@@ -4199,7 +4199,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
         DATA = "data" * 100
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _stash_uri(ur, which):
-            self.uris[which] = ur.uri
+            self.uris[which] = ur.get_uri()
         d.addCallback(_stash_uri, "good")
         d.addCallback(lambda ign:
                       c0.upload(upload.Data(DATA+"1", convergence="")))
@@ -4344,7 +4344,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
         DATA = "data" * 100
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _stash_uri(ur, which):
-            self.uris[which] = ur.uri
+            self.uris[which] = ur.get_uri()
         d.addCallback(_stash_uri, "good")
         d.addCallback(lambda ign:
                       c0.upload(upload.Data(DATA+"1", convergence="")))
@@ -4425,7 +4425,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
         DATA = "data" * 100
         d = c0.upload(upload.Data(DATA+"1", convergence=""))
         def _stash_uri(ur, which):
-            self.uris[which] = ur.uri
+            self.uris[which] = ur.get_uri()
         d.addCallback(_stash_uri, "sick")
 
         def _compute_fileurls(ignored):
@@ -5011,7 +5011,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
         DATA = "data" * 100
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _stash_uri(ur, which):
-            self.uris[which] = ur.uri
+            self.uris[which] = ur.get_uri()
         d.addCallback(_stash_uri, "one")
         d.addCallback(lambda ign:
                       c0.upload(upload.Data(DATA+"1", convergence="")))
@@ -5180,10 +5180,10 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
         d.addCallback(_stash_root)
         d.addCallback(lambda ign: c0.upload(upload.Data(DATA, convergence="")))
         def _stash_bad(ur):
-            self.fileurls["1share"] = "uri/" + urllib.quote(ur.uri)
-            self.delete_shares_numbered(ur.uri, range(1,10))
+            self.fileurls["1share"] = "uri/" + urllib.quote(ur.get_uri())
+            self.delete_shares_numbered(ur.get_uri(), range(1,10))
 
-            u = uri.from_string(ur.uri)
+            u = uri.from_string(ur.get_uri())
             u.key = testutil.flip_bit(u.key, 0)
             baduri = u.to_string()
             self.fileurls["0shares"] = "uri/" + urllib.quote(baduri)
@@ -5394,7 +5394,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
 
         d = c0.upload(upload.Data(DATA, convergence=""))
         def _stash_uri_and_create_dir(ur):
-            self.uri = ur.uri
+            self.uri = ur.get_uri()
             self.url = "uri/"+self.uri
             u = uri.from_string_filenode(self.uri)
             self.si = u.get_storage_index()
index 8fa88479b27fd3031c9e18e62b4e316e54f76549..64ebec7b7aa2deb257ed064ed8e668644a8494d7 100644 (file)
@@ -13,7 +13,7 @@ def PUTUnlinkedCHK(req, client):
     # "PUT /uri", to create an unlinked file.
     uploadable = FileHandle(req.content, client.convergence)
     d = client.upload(uploadable)
-    d.addCallback(lambda results: results.uri)
+    d.addCallback(lambda results: results.get_uri())
     # that fires with the URI of the new file
     return d
 
@@ -50,7 +50,7 @@ def POSTUnlinkedCHK(req, client):
         # usual upload-results page
         def _done(upload_results, redir_to):
             if "%(uri)s" in redir_to:
-                redir_to = redir_to % {"uri": urllib.quote(upload_results.uri)
+                redir_to = redir_to % {"uri": urllib.quote(upload_results.get_uri())
                                          }
             return url.URL.fromString(redir_to)
         d.addCallback(_done, when_done)
@@ -78,13 +78,14 @@ class UploadResultsPage(status.UploadResultsRendererMixin, rend.Page):
 
     def data_uri(self, ctx, data):
         d = self.upload_results()
-        d.addCallback(lambda res: res.uri)
+        d.addCallback(lambda res: res.get_uri())
         return d
 
     def render_download_link(self, ctx, data):
         d = self.upload_results()
-        d.addCallback(lambda res: T.a(href="/uri/" + urllib.quote(res.uri))
-                      ["/uri/" + res.uri])
+        d.addCallback(lambda res:
+                      T.a(href="/uri/" + urllib.quote(res.get_uri()))
+                      ["/uri/" + res.get_uri()])
         return d
 
 def POSTUnlinkedSSK(req, client, version):