summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/src/leap/soledad/client/http_target.py6
-rw-r--r--client/src/leap/soledad/client/http_target/api.py3
-rw-r--r--common/src/leap/soledad/common/couch.py15
3 files changed, 16 insertions, 8 deletions
diff --git a/client/src/leap/soledad/client/http_target.py b/client/src/leap/soledad/client/http_target.py
index ed538add..046af089 100644
--- a/client/src/leap/soledad/client/http_target.py
+++ b/client/src/leap/soledad/client/http_target.py
@@ -402,7 +402,8 @@ class SoledadHTTPSyncTarget(SyncTarget):
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(
+ initial_body, docs_by_generation)
while len(entries):
result = yield self._http_request(
self._url,
@@ -663,7 +664,8 @@ class SoledadHTTPSyncTarget(SyncTarget):
insert_doc_cb=self._insert_doc_cb,
source_replica_uid=self.source_replica_uid)
- def _http_request(self, url, method='GET', body=None, headers=None, content_type=None):
+ def _http_request(self, url, method='GET', body=None, headers=None,
+ content_type=None):
headers = headers or self._base_header
if content_type:
headers.update({'content-type': [content_type]})
diff --git a/client/src/leap/soledad/client/http_target/api.py b/client/src/leap/soledad/client/http_target/api.py
index 98a5b47e..dc13e9cc 100644
--- a/client/src/leap/soledad/client/http_target/api.py
+++ b/client/src/leap/soledad/client/http_target/api.py
@@ -56,7 +56,8 @@ class SyncTargetAPI(SyncTarget):
def _defer_encryption(self):
return self._sync_enc_pool is not None
- def _http_request(self, url, method='GET', body=None, headers=None, content_type=None):
+ def _http_request(self, url, method='GET', body=None, headers=None,
+ content_type=None):
headers = headers or self._base_header
if content_type:
headers.update({'content-type': [content_type]})
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index 08096f86..82b5aca8 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -1207,7 +1207,8 @@ class CouchDatabase(CommonBackend):
:type doc: CouchDocument
"""
my_doc = self._get_doc(doc.doc_id, check_for_conflicts=True)
- doc.prune_conflicts(vectorclock.VectorClockRev(doc.rev), self._replica_uid)
+ doc.prune_conflicts(
+ vectorclock.VectorClockRev(doc.rev), self._replica_uid)
doc.add_conflict(my_doc)
self._put_doc(my_doc, doc)
@@ -1327,8 +1328,10 @@ class CouchDatabase(CommonBackend):
doc_idx, sync_id)
my_doc = self._get_doc(doc.doc_id, check_for_conflicts=True)
if my_doc is not None:
- my_doc.set_conflicts(self.get_doc_conflicts(my_doc.doc_id, my_doc.couch_rev))
- state, save_doc = _process_incoming_doc(my_doc, doc, save_conflict, self.replica_uid)
+ my_doc.set_conflicts(
+ self.get_doc_conflicts(my_doc.doc_id, my_doc.couch_rev))
+ state, save_doc = _process_incoming_doc(
+ my_doc, doc, save_conflict, self.replica_uid)
if save_doc:
self._put_doc(my_doc, save_doc)
doc.update(save_doc)
@@ -1503,7 +1506,8 @@ def _process_incoming_doc(my_doc, other_doc, save_conflict, replica_uid):
# at this point, `doc` has arrived from the other syncing party, and
# we will decide what to do with it.
# First, we prepare the arriving doc to update couch database.
- new_doc = CouchDocument(other_doc.doc_id, other_doc.rev, other_doc.get_json())
+ new_doc = CouchDocument(
+ other_doc.doc_id, other_doc.rev, other_doc.get_json())
if my_doc is None:
return 'inserted', new_doc
new_doc.couch_rev = my_doc.couch_rev
@@ -1537,7 +1541,8 @@ def _process_incoming_doc(my_doc, other_doc, save_conflict, replica_uid):
return 'superseded', new_doc
else:
if save_conflict:
- new_doc.prune_conflicts(vectorclock.VectorClockRev(new_doc.rev), replica_uid)
+ new_doc.prune_conflicts(
+ vectorclock.VectorClockRev(new_doc.rev), replica_uid)
new_doc.add_conflict(my_doc)
return 'conflicted', new_doc
other_doc.update(new_doc)