From 7c4166e607a4d907cc20f9e0afbe8093df917a14 Mon Sep 17 00:00:00 2001 From: muellermichel Date: Wed, 19 Feb 2014 12:18:53 +0100 Subject: [PATCH] Update client.py handling of doc update responses without id and/or rev - this is needed for the correct handling of security docs. --- couchdbkit/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/couchdbkit/client.py b/couchdbkit/client.py index a4b84e3..10deb80 100644 --- a/couchdbkit/client.py +++ b/couchdbkit/client.py @@ -510,8 +510,10 @@ def save_doc(self, doc, encode_attachments=True, force_update=False, if 'batch' in params and 'id' in res: doc1.update({ '_id': res['id']}) else: - doc1.update({'_id': res['id'], '_rev': res['rev']}) - + if 'id' in res: + doc1['_id'] = res['id'] + if 'rev' in res: + doc1['_rev'] = res['rev'] if schema: doc._doc = doc1