summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/leap/soledad/common/couch/__init__.py5
-rw-r--r--common/src/leap/soledad/common/l2db/remote/http_app.py4
-rw-r--r--server/src/leap/soledad/server/sync.py3
3 files changed, 7 insertions, 5 deletions
diff --git a/common/src/leap/soledad/common/couch/__init__.py b/common/src/leap/soledad/common/couch/__init__.py
index d751747d..1a95e590 100644
--- a/common/src/leap/soledad/common/couch/__init__.py
+++ b/common/src/leap/soledad/common/couch/__init__.py
@@ -348,8 +348,7 @@ class CouchDatabase(object):
result['_attachments'] = {}
for file_name in attachment_file_names:
result['_attachments'][file_name] = {
- 'data': json.load(
- self._database.get_attachment(result, file_name))
+ 'data': self._database.get_attachment(result, file_name)
}
doc = self.__parse_doc_from_couch(
result, result['_id'],
@@ -432,7 +431,7 @@ class CouchDatabase(object):
binascii.a2b_base64(
result['_attachments']['u1db_content']['data']))
else:
- doc.content = result['_attachments']['u1db_content']['data']
+ doc._json = result['_attachments']['u1db_content']['data']
# determine if there are conflicts
if check_for_conflicts \
and '_attachments' in result \
diff --git a/common/src/leap/soledad/common/l2db/remote/http_app.py b/common/src/leap/soledad/common/l2db/remote/http_app.py
index 5cf6645e..a9680890 100644
--- a/common/src/leap/soledad/common/l2db/remote/http_app.py
+++ b/common/src/leap/soledad/common/l2db/remote/http_app.py
@@ -501,7 +501,9 @@ class HTTPResponder(object):
self._write('\r\n')
else:
self._write(',\r\n')
- self._write(json.dumps(entry))
+ if type(entry) == dict:
+ entry = json.dumps(entry)
+ self._write(entry)
def end_stream(self):
"end stream (array)."
diff --git a/server/src/leap/soledad/server/sync.py b/server/src/leap/soledad/server/sync.py
index a0324a27..253139a9 100644
--- a/server/src/leap/soledad/server/sync.py
+++ b/server/src/leap/soledad/server/sync.py
@@ -248,9 +248,10 @@ class SyncResource(http_app.SyncResource):
"""
def send_doc(doc, gen, trans_id):
- entry = dict(id=doc.doc_id, rev=doc.rev, content=doc.get_json(),
+ entry = dict(id=doc.doc_id, rev=doc.rev,
gen=gen, trans_id=trans_id)
self.responder.stream_entry(entry)
+ self.responder.stream_entry(doc.get_json().read())
new_gen, number_of_changes = \
self.sync_exch.find_changes_to_return(received)