You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2010/02/28 03:48:33 UTC
svn commit: r917104 - in /couchdb/trunk:
share/www/script/test/show_documents.js src/couchdb/couch_httpd_show.erl
Author: jan
Date: Sun Feb 28 02:48:32 2010
New Revision: 917104
URL: http://svn.apache.org/viewvc?rev=917104&view=rev
Log:
treat deleted docs as nonexistant docs
Modified:
couchdb/trunk/share/www/script/test/show_documents.js
couchdb/trunk/src/couchdb/couch_httpd_show.erl
Modified: couchdb/trunk/share/www/script/test/show_documents.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/show_documents.js?rev=917104&r1=917103&r2=917104&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/show_documents.js (original)
+++ couchdb/trunk/share/www/script/test/show_documents.js Sun Feb 28 02:48:32 2010
@@ -54,6 +54,13 @@
json : req
}
}),
+ "show-deleted" : stringFun(function(doc, req) {
+ if(doc) {
+ return doc._id;
+ } else {
+ return "No doc " + req.id;
+ }
+ }),
"render-error" : stringFun(function(doc, req) {
return noSuchVariable;
}),
@@ -393,5 +400,15 @@
T(xhr.responseText == "Hey Dude");
TEquals("Yeah", xhr.getResponseHeader("X-Couch-Test-Header"), "header should be cool");
TEquals("Oh Yeah!", xhr.getResponseHeader("X-Couch-Test-Header-Awesome"), "header should be cool");
+
+ // test deleted docs
+ var doc = {_id:"testdoc",foo:1};
+ db.save(doc);
+ var xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/show-deleted/testdoc");
+ TEquals("testdoc", xhr.responseText, "should return 'testdoc'");
+
+ db.deleteDoc(doc);
+ var xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/show-deleted/testdoc");
+ TEquals("No doc testdoc", xhr.responseText, "should return 'no doc testdoc'");
};
Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=917104&r1=917103&r2=917104&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Sun Feb 28 02:48:32 2010
@@ -31,6 +31,7 @@
maybe_open_doc(Db, DocId) ->
case catch couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) of
{not_found, missing} -> nil;
+ {not_found,deleted} -> nil;
Doc -> Doc
end.
handle_doc_show_req(#httpd{