lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Implement document copy [PATCH] #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Attached is a working first pass at exposing CouchDB's document copy
feature. I have not added unit tests for but will do so if my approach is
the right one.

A couple of potential changes to the patch.

Right now the new Database.copy method requires a Document instance but it
could be made to take either a Document or just an ID like .get_attachment.

After the copy is completed the newly created Document is fetched and
returned. Perhaps the method should let the caller decide if they want to
fetch the new Document.

This was tested on CouchDB 0.9.0 so I cannot vouch it works for 0.8.x.

Original issue reported on code.google.com by thomas.j...@gmail.com on 16 Apr 2009 at 3:39

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks, added in r155. I've changed the implementation to only return the rev 
of the destination document.

Original comment by cmlenz on 29 Jun 2009 at 1:12

GoogleCodeExporter commented 8 years ago
Great. I've only glanced at the diff but is dest = src.items() what you want at 
line
372? Seems like that would copy the '_id' too.

Original comment by thomas.j...@gmail.com on 29 Jun 2009 at 2:15

GoogleCodeExporter commented 8 years ago
Gah! Good catch, thanks :) Should be fixed in r159.

Original comment by cmlenz on 29 Jun 2009 at 2:34