From: Brian Warner Date: Tue, 22 May 2012 04:14:44 +0000 (-0700) Subject: switch UploadResults to use get_uri(), hide internal ._uri X-Git-Url: https://git.rkrishnan.org/vdrive/components/COPYING.GPL?a=commitdiff_plain;h=3d771132a843a85578dc23a6cac55b4fae09fc64;p=tahoe-lafs%2Ftahoe-lafs.git switch UploadResults to use get_uri(), hide internal ._uri 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(). --- diff --git a/src/allmydata/control.py b/src/allmydata/control.py index fcde8fab..15ab382d 100644 --- a/src/allmydata/control.py +++ b/src/allmydata/control.py @@ -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 diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index b0bb72d2..7941e623 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -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 diff --git a/src/allmydata/immutable/upload.py b/src/allmydata/immutable/upload.py index bfd61345..81f18a8f 100644 --- a/src/allmydata/immutable/upload.py +++ b/src/allmydata/immutable/upload.py @@ -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): diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index bac3df27..93063d3c 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -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 diff --git a/src/allmydata/nodemaker.py b/src/allmydata/nodemaker.py index d0c9b4b6..c820c71c 100644 --- a/src/allmydata/nodemaker.py +++ b/src/allmydata/nodemaker.py @@ -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 diff --git a/src/allmydata/test/test_checker.py b/src/allmydata/test/test_checker.py index f6e60477..f88ba5c2 100644 --- a/src/allmydata/test/test_checker.py +++ b/src/allmydata/test/test_checker.py @@ -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): diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 5aa58786..c88d00b3 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -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 diff --git a/src/allmydata/test/test_download.py b/src/allmydata/test/test_download.py index a1551822..710d98ed 100644 --- a/src/allmydata/test/test_download.py +++ b/src/allmydata/test/test_download.py @@ -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:] diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py index c06fbbd3..91c2ece9 100644 --- a/src/allmydata/test/test_encode.py +++ b/src/allmydata/test/test_encode.py @@ -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 diff --git a/src/allmydata/test/test_helper.py b/src/allmydata/test/test_helper.py index 6ba7b7e6..909e3e5d 100644 --- a/src/allmydata/test/test_helper.py +++ b/src/allmydata/test/test_helper.py @@ -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) diff --git a/src/allmydata/test/test_hung_server.py b/src/allmydata/test/test_hung_server.py index 776135dc..e2d6f6a1 100644 --- a/src/allmydata/test/test_hung_server.py +++ b/src/allmydata/test/test_hung_server.py @@ -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 diff --git a/src/allmydata/test/test_immutable.py b/src/allmydata/test/test_immutable.py index f1e0c7b2..963cedae 100644 --- a/src/allmydata/test/test_immutable.py +++ b/src/allmydata/test/test_immutable.py @@ -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 diff --git a/src/allmydata/test/test_no_network.py b/src/allmydata/test/test_no_network.py index ef7eed5c..345662f7 100644 --- a/src/allmydata/test/test_no_network.py +++ b/src/allmydata/test/test_no_network.py @@ -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): diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index 168d84c2..65d2b2c2 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -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) diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 4a8e4061..f3b72f53 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -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") diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index 99116de4..6a83f580 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -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): diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index dddc501c..ca3c85f0 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -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() diff --git a/src/allmydata/web/unlinked.py b/src/allmydata/web/unlinked.py index 8fa88479..64ebec7b 100644 --- a/src/allmydata/web/unlinked.py +++ b/src/allmydata/web/unlinked.py @@ -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):