couchdbkit
couchdbkit copied to clipboard
Keyerror when saving security docs
This issue is related to #134.
There still seems to be a problem when saving security documents. I get
File "/usr/local/lib/python2.7/dist-packages/couchdbkit/client.py", line 513, in save_doc; doc1.update({'_id': res['id'], '_rev': res['rev']});KeyError: 'id';
The code lines in question are 510ff in client.py:
if 'batch' in params and 'id' in res:
doc1.update({ '_id': res['id']})
else:
doc1.update({'_id': res['id'], '_rev': res['rev']})
Obviously, the 'id' in res check is useless since in the else case it's still being accessed directly from the response dict.
use: db.set_security(secobj)