couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1172374 - /couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl
Date Sun, 18 Sep 2011 21:50:27 GMT
Author: davisp
Date: Sun Sep 18 21:50:27 2011
New Revision: 1172374

URL: http://svn.apache.org/viewvc?rev=1172374&view=rev
Log:
Fix _update calls when creating docs.

With the docid fix, this clause was being overshadowed by a looser
pattern matching spec. Just needed to be reordered to detect when no
docid was provided.


Modified:
    couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl

Modified: couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl?rev=1172374&r1=1172373&r2=1172374&view=diff
==============================================================================
--- couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl (original)
+++ couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl Sun Sep 18 21:50:27 2011
@@ -101,12 +101,20 @@ show_etag(#httpd{user_ctx=UserCtx}=Req, 
     couch_httpd:make_etag({couch_httpd:doc_etag(DDoc), DocPart, Accept,
         UserCtx#user_ctx.roles, More}).
 
-% /db/_design/foo/_update/bar/docid
 % updates a doc based on a request
 % handle_doc_update_req(#httpd{method = 'GET'}=Req, _Db, _DDoc) ->
 %     % anything but GET
 %     send_method_not_allowed(Req, "POST,PUT,DELETE,ETC");
 
+% This call is creating a new doc using an _update function to
+% modify the provided request body.
+% /db/_design/foo/_update/bar
+handle_doc_update_req(#httpd{
+        path_parts=[_, _, _, _, UpdateName]
+    }=Req, Db, DDoc) ->
+    send_doc_update_response(Req, Db, DDoc, UpdateName, nil, null);
+
+% /db/_design/foo/_update/bar/docid
 handle_doc_update_req(#httpd{
         path_parts=[_, _, _, _, UpdateName | DocIdParts]
     }=Req, Db, DDoc) ->
@@ -114,10 +122,6 @@ handle_doc_update_req(#httpd{
     Doc = maybe_open_doc(Db, DocId),
     send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId);
 
-handle_doc_update_req(#httpd{
-        path_parts=[_, _, _, _, UpdateName]
-    }=Req, Db, DDoc) ->
-    send_doc_update_response(Req, Db, DDoc, UpdateName, nil, null);
 
 handle_doc_update_req(Req, _Db, _DDoc) ->
     couch_httpd:send_error(Req, 404, <<"update_error">>, <<"Invalid path.">>).



Mime
View raw message