histrio / py-couchdb

Modern pure python CouchDB Client.
https://pycouchdb.readthedocs.org/
Other
120 stars 43 forks source link

delete_attachment don't delete the attachment #14

Closed dedalus2000 closed 11 years ago

dedalus2000 commented 11 years ago

The delete_attachment function deletes the file in the database, but does not delete it from the the document instance

In fact I can see in the source client.py#420: .. if r.status_code < 206: _doc['_rev'] = d['rev'] return _doc ..

So only the _rev attribute is updated, but the file informations will remain in the _doc['_attachment'] object

dedalus2000 commented 11 years ago

sorry for the tabs-alignment but my solution should be simple to understand

diff new_client.py old_client.py 421,427d420 < try: < # we are under try/except as far we can delete nonexistent attachments < del _doc['_attachments'][filename] < if not _doc['_attachments']: < del _doc['_attachments'] < except: < pass

niwinz commented 11 years ago

Thanks for you explanation! I fix it this afternoon. ;)