From 6d26d440a278ad4cd2ed9edb3bb3e7c97a12b6e8 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 22 Mar 2017 00:05:40 -0300 Subject: [refactor] change size into a required parameter where it is necessary --- client/src/leap/soledad/client/_blobs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/leap/soledad/client/_blobs.py b/client/src/leap/soledad/client/_blobs.py index 92aa42cf..eb09d69f 100644 --- a/client/src/leap/soledad/client/_blobs.py +++ b/client/src/leap/soledad/client/_blobs.py @@ -164,7 +164,7 @@ class BlobManager(object): return self.local.close() @defer.inlineCallbacks - def put(self, doc): + def put(self, doc, size): fd = doc.blob_fd # TODO this is a tee really, but ok... could do db and upload # concurrently. not sure if we'd gain something. @@ -407,9 +407,10 @@ def testit(reactor): def _put(blob_id, payload): logger.info(":: Starting full put: %s" % blob_id) manager = _manager() + size = os.path.getsize(payload) with open(payload) as fd: doc = BlobDoc('mydoc', '1', fd, blob_id=blob_id) - result = yield manager.put(doc) + result = yield manager.put(doc, size=size) logger.info(":: Result of put: %s" % str(result)) logger.info(":: Finished full put: %s" % blob_id) -- cgit v1.2.3