summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-09-16 19:34:37 -0300
committerdrebs <drebs@leap.se>2016-12-12 09:11:58 -0200
commitea3eea052069d5cc933937fd077d94569e4336a4 (patch)
treec73bd09d016f28fb695dc1b170dce028963c1777
parent5d056170357acd0945899d7f0c40f530cbe816e0 (diff)
[feature] simple adaptation to let the client run
Make the client parse a 2-line doc on sync download stream.
-rw-r--r--client/src/leap/soledad/client/http_target/fetch.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/http_target/fetch.py b/client/src/leap/soledad/client/http_target/fetch.py
index 0fb5040f..24d73025 100644
--- a/client/src/leap/soledad/client/http_target/fetch.py
+++ b/client/src/leap/soledad/client/http_target/fetch.py
@@ -200,11 +200,12 @@ class HTTPDocFetcher(object):
self._ensure_callback(metadata['replica_uid'])
# parse incoming document info
entries = []
- for data in data[1:]:
+ for index in xrange(1, len(data[1:]), 2):
try:
- line, comma = utils.check_and_strip_comma(data)
+ line, comma = utils.check_and_strip_comma(data[index])
+ content, _ = utils.check_and_strip_comma(data[index + 1])
entry = json.loads(line)
- entries.append((entry['id'], entry['rev'], entry['content'],
+ entries.append((entry['id'], entry['rev'], content,
entry['gen'], entry['trans_id']))
except (IndexError, KeyError):
raise errors.BrokenSyncStream