summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad/common/couch/__init__.py
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-09-16 19:33:06 -0300
committerdrebs <drebs@leap.se>2016-12-12 09:11:58 -0200
commit5d056170357acd0945899d7f0c40f530cbe816e0 (patch)
treea04cb4080e53777cba4b603cdc4a18c2edfeda3e /common/src/leap/soledad/common/couch/__init__.py
parent1e3de25ce10156655bcb1bc879f5340baa889ead (diff)
[feature] server download stream from file object
couchdb lib returns a file object representing the attachment. This commit dumps the read() call into the wsgi write() call. Doc representation uses 2 lines also, separating metadata from content.
Diffstat (limited to 'common/src/leap/soledad/common/couch/__init__.py')
-rw-r--r--common/src/leap/soledad/common/couch/__init__.py5
1 files changed, 2 insertions, 3 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 \