Author: davisp
Date: Sat Apr 18 16:22:55 2009
New Revision: 766348

URL: http://svn.apache.org/viewvc?rev=766348&view=rev
Log:
Merged 766347 from trunk.

Modified:
    couchdb/branches/0.9.x/   (props changed)
    couchdb/branches/0.9.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.9.x/share/www/script/test/view_errors.js
    couchdb/branches/0.9.x/src/couchdb/couch_db.hrl
    couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl

Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 16:22:55 2009
@@ -1,3 +1,3 @@
 /couchdb/branches/design_resources:751716-751803
 /couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420
+/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347

Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 16:22:55 2009
@@ -1,4 +1,4 @@
 /couchdb/branches/design_resources/etc/default/couchdb:751716-751803
 /couchdb/branches/form/etc/default/couchdb:729440-730015
-/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420
+/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.9.x/share/www/script/test/view_errors.js
URL: 
http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/view_errors.js?rev=766348&r1=766347&r2=766348&view=diff
==============================================================================
--- couchdb/branches/0.9.x/share/www/script/test/view_errors.js (original)
+++ couchdb/branches/0.9.x/share/www/script/test/view_errors.js Sat Apr 18 
16:22:55 2009
@@ -81,6 +81,14 @@
   }
   
   try {
+    db.view("test/no_reduce", {reduce: true});
+    T(0 == 1);
+  } catch(e) {
+    T(db.last_req.status == 400);
+    T(e.error == "query_parse_error");
+  }
+
+  try {
       db.view("test/with_reduce", {group: true, reduce: false});
       T(0 == 1);
   } catch(e) {

Modified: couchdb/branches/0.9.x/src/couchdb/couch_db.hrl
URL: 
http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_db.hrl?rev=766348&r1=766347&r2=766348&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_db.hrl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_db.hrl Sat Apr 18 16:22:55 2009
@@ -155,6 +155,7 @@
     skip = 0,
     group_level = 0,
     reduce = true,
+    req_reduce = false,
     inclusive_end=true, % aka a closed-interval
     include_docs = false
 }).

Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl
URL: 
http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl?rev=766348&r1=766347&r2=766348&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl Sat Apr 18 16:22:55 
2009
@@ -363,9 +363,15 @@
         {"inclusive_end", "false"} ->
             Args#view_query_args{inclusive_end=false};
         {"reduce", "true"} ->
-            Args#view_query_args{reduce=true};
+            Args#view_query_args{
+                reduce=true,
+                req_reduce=true
+            };
         {"reduce", "false"} ->
-            Args#view_query_args{reduce=false};
+            Args#view_query_args{
+                reduce=false,
+                req_reduce=true
+            };
         {"include_docs", Value} ->
             case Value of
             "true" ->
@@ -400,7 +406,18 @@
             ok
         end;
     _ ->
-        ok
+        case QueryArgs#view_query_args.req_reduce of
+        true ->
+            case QueryArgs#view_query_args.reduce of
+            true ->
+                ErrMsg = <<"Bad URL parameter: reduce=true">>,
+                throw({query_parse_error, ErrMsg});
+            _ ->
+                ok
+            end;
+        _ ->
+            ok
+        end
     end,
     case Keys of
     nil ->


Reply via email to