couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r893261 - in /couchdb/trunk: share/www/script/test/show_documents.js src/couchdb/couch_httpd_db.erl
Date Tue, 22 Dec 2009 18:32:13 GMT
Author: jchris
Date: Tue Dec 22 18:32:12 2009
New Revision: 893261

URL: http://svn.apache.org/viewvc?rev=893261&view=rev
Log:
remove show from db doc GET handler, completing flip-flop on COUCHDB-404

Modified:
    couchdb/trunk/share/www/script/test/show_documents.js
    couchdb/trunk/src/couchdb/couch_httpd_db.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=893261&r1=893260&r2=893261&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/show_documents.js (original)
+++ couchdb/trunk/share/www/script/test/show_documents.js Tue Dec 22 18:32:12 2009
@@ -138,16 +138,9 @@
   // hello template world
   xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/"+docid);
   T(xhr.responseText == "Hello World", "hello");
-  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
-
-  // Fix for COUCHDB-379
-  T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
+  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")));
 
 
-  xhr = CouchDB.request("GET", "/test_suite_db/"+docid+"?show=template/hello");
-  T(xhr.responseText == "Hello World");
-  T(/charset=utf-8/.test(xhr.getResponseHeader("Content-Type")))
-
   // Fix for COUCHDB-379
   T(equals(xhr.getResponseHeader("Server").substr(0,7), "CouchDB"));
 
@@ -173,9 +166,6 @@
   xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/"+docid);
   T(xhr.responseText == "Just Rusty");
 
-  xhr = CouchDB.request("GET", "/test_suite_db/"+docid+"?show=template/just-name");
-  T(xhr.responseText == "Just Rusty");
-
   // show with missing doc
   xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/just-name/missingdoc");
   T(xhr.status == 404);

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=893261&r1=893260&r2=893261&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Tue Dec 22 18:32:12 2009
@@ -29,7 +29,6 @@
     options = [],
     rev = nil,
     open_revs = [],
-    show = nil,
     update_type = interactive_edit,
     atts_since = nil
 }).
@@ -676,56 +675,44 @@
 
 db_doc_req(#httpd{method='GET'}=Req, Db, DocId) ->
     #doc_query_args{
-        show = Format,
         rev = Rev,
         open_revs = Revs,
         options = Options,
         atts_since = AttsSince
     } = parse_doc_query(Req),
-    case Format of
-    nil ->
-        case Revs of
-        [] ->
-            Doc = couch_doc_open(Db, DocId, Rev, Options),
-            Options2 =
-            if AttsSince /= nil ->
-                RevPos = find_ancestor_rev_pos(Doc#doc.revs, AttsSince),
-                [{atts_after_revpos, RevPos} | Options];
-            true -> Options
-            end,
-            send_doc(Req, Doc, Options2);
-        _ ->
-            {ok, Results} = couch_db:open_doc_revs(Db, DocId, Revs, Options),
-            {ok, Resp} = start_json_response(Req, 200),
-            send_chunk(Resp, "["),
-            % We loop through the docs. The first time through the separator
-            % is whitespace, then a comma on subsequent iterations.
-            lists:foldl(
-                fun(Result, AccSeparator) ->
-                    case Result of
-                    {ok, Doc} ->
-                        JsonDoc = couch_doc:to_json_obj(Doc, Options),
-                        Json = ?JSON_ENCODE({[{ok, JsonDoc}]}),
-                        send_chunk(Resp, AccSeparator ++ Json);
-                    {{not_found, missing}, RevId} ->
-                        RevStr = couch_doc:rev_to_str(RevId),
-                        Json = ?JSON_ENCODE({[{"missing", RevStr}]}),
-                        send_chunk(Resp, AccSeparator ++ Json)
-                    end,
-                    "," % AccSeparator now has a comma
-                end,
-                "", Results),
-            send_chunk(Resp, "]"),
-            end_json_response(Resp)
-        end;
-    _ ->
-        {DesignName, ShowName} = Format,
-        % load ddoc
-        DesignId = <<"_design/", DesignName/binary>>,
-        DDoc = couch_httpd_db:couch_doc_open(Db, DesignId, nil, []),
-        % open doc
+    case Revs of
+    [] ->
         Doc = couch_doc_open(Db, DocId, Rev, Options),
-        couch_httpd_show:handle_doc_show(Req, Db, DDoc, ShowName, Doc)
+        Options2 =
+        if AttsSince /= nil ->
+            RevPos = find_ancestor_rev_pos(Doc#doc.revs, AttsSince),
+            [{atts_after_revpos, RevPos} | Options];
+        true -> Options
+        end,
+        send_doc(Req, Doc, Options2);
+    _ ->
+        {ok, Results} = couch_db:open_doc_revs(Db, DocId, Revs, Options),
+        {ok, Resp} = start_json_response(Req, 200),
+        send_chunk(Resp, "["),
+        % We loop through the docs. The first time through the separator
+        % is whitespace, then a comma on subsequent iterations.
+        lists:foldl(
+            fun(Result, AccSeparator) ->
+                case Result of
+                {ok, Doc} ->
+                    JsonDoc = couch_doc:to_json_obj(Doc, Options),
+                    Json = ?JSON_ENCODE({[{ok, JsonDoc}]}),
+                    send_chunk(Resp, AccSeparator ++ Json);
+                {{not_found, missing}, RevId} ->
+                    RevStr = couch_doc:rev_to_str(RevId),
+                    Json = ?JSON_ENCODE({[{"missing", RevStr}]}),
+                    send_chunk(Resp, AccSeparator ++ Json)
+                end,
+                "," % AccSeparator now has a comma
+            end,
+            "", Results),
+        send_chunk(Resp, "]"),
+        end_json_response(Resp)
     end;
 
 db_doc_req(#httpd{method='POST'}=Req, Db, DocId) ->
@@ -1151,8 +1138,6 @@
         {"atts_since", RevsJsonStr} ->
             JsonArray = ?JSON_DECODE(RevsJsonStr),
             Args#doc_query_args{atts_since = couch_doc:parse_revs(JsonArray)};
-        {"show", FormatStr} ->
-            Args#doc_query_args{show=parse_doc_format(FormatStr)};
         {"new_edits", "false"} ->
             Args#doc_query_args{update_type=replicated_changes};
         {"new_edits", "true"} ->



Mime
View raw message