summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-09-16 19:34:37 -0300
committerVictor Shyba <victor1984@riseup.net>2016-11-18 15:55:52 -0300
commita96212203e80ca0d39ed783f9d72ebad019d772b (patch)
tree55e9fe2733c572d23b5fcc07bf61c9aec8da4147
parentf1f0b6fced4e100fa1aed73fd64bca43c239ccc5 (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