diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-08-19 19:09:59 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-08-26 17:20:22 -0300 |
commit | 8654021f8719cf9d0f17f9d58e4455074aa43bb9 (patch) | |
tree | 3de784b68a1021e8d9a01051c15b1743a70eaa8d /client/src/leap/soledad/client/http_target/send.py | |
parent | 5926e11838a6d71aa3b7865b52b2ba2fab30b203 (diff) |
[bug] fixes small issues pointed by drebs
* file headers
* variable names
* missing docstrings
* prune_conflicts
** extra: tests failed on a 1-based index bug
Diffstat (limited to 'client/src/leap/soledad/client/http_target/send.py')
-rw-r--r-- | client/src/leap/soledad/client/http_target/send.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/client/src/leap/soledad/client/http_target/send.py b/client/src/leap/soledad/client/http_target/send.py index de18df8b..a6e64908 100644 --- a/client/src/leap/soledad/client/http_target/send.py +++ b/client/src/leap/soledad/client/http_target/send.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# http_target.py +# send.py # Copyright (C) 2015 LEAP # # This program is free software: you can redistribute it and/or modify @@ -33,13 +33,13 @@ class HTTPDocSender(object): defer.returnValue([None, None]) # add remote replica metadata to the request - initial_body = RequestBody( + metadata = RequestBody( last_known_generation=last_known_generation, last_known_trans_id=last_known_trans_id, sync_id=sync_id, ensure=self._ensure_callback is not None) total = len(docs_by_generation) - entries = yield self._entries_from_docs(initial_body, docs_by_generation) + entries = yield self._entries_from_docs(metadata, docs_by_generation) while len(entries): result = yield self._http_request( self._url, @@ -49,14 +49,14 @@ class HTTPDocSender(object): idx = total - len(entries) if self._defer_encryption: self._delete_sent(idx, docs_by_generation) - _emit_send(idx, total) + _emit_send_status(idx, total) response_dict = json.loads(result)[0] gen_after_send = response_dict['new_generation'] trans_id_after_send = response_dict['new_transaction_id'] defer.returnValue([gen_after_send, trans_id_after_send]) def _delete_sent(self, idx, docs_by_generation): - doc = docs_by_generation[idx][0] + doc = docs_by_generation[idx - 1][0] self._sync_enc_pool.delete_encrypted_doc( doc.doc_id, doc.rev) @@ -93,7 +93,7 @@ class HTTPDocSender(object): return d -def _emit_send(idx, total): +def _emit_send_status(idx, total): msg = "%d/%d" % (idx, total) emit( SOLEDAD_SYNC_SEND_STATUS, |