You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/10/19 16:51:58 UTC
svn commit: r826693 - in /couchdb/branches/0.10.x: ./ etc/default/couchdb
share/www/script/test/list_views.js src/couchdb/couch_httpd_show.erl
Author: davisp
Date: Mon Oct 19 14:51:58 2009
New Revision: 826693
URL: http://svn.apache.org/viewvc?rev=826693&view=rev
Log:
Backport multi-design-doc _list bug fix.
See commit for r826692.
Modified:
couchdb/branches/0.10.x/ (props changed)
couchdb/branches/0.10.x/etc/default/couchdb (props changed)
couchdb/branches/0.10.x/share/www/script/test/list_views.js
couchdb/branches/0.10.x/src/couchdb/couch_httpd_show.erl
Propchange: couchdb/branches/0.10.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 19 14:51:58 2009
@@ -4,4 +4,4 @@
/couchdb/branches/list-iterator:782292-784593
/couchdb/branches/tail_header:775760-778477
/couchdb/tags/0.10.0:825400
-/couchdb/trunk:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817278,817398,817400,817403,817749,817793,818249,818357,819091,819341,819343,819436,819799,819977,820344,820469,820495,820851,825407
+/couchdb/trunk:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817278,817398,817400,817403,817749,817793,818249,818357,819091,819341,819343,819436,819799,819977,820344,820469,820495,820851,825407,826692
Propchange: couchdb/branches/0.10.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 19 14:51:58 2009
@@ -4,5 +4,5 @@
/couchdb/branches/list-iterator/etc/default/couchdb:782292-784593
/couchdb/branches/tail_header/etc/default/couchdb:775760-778477
/couchdb/tags/0.10.0/etc/default/couchdb:825400
-/couchdb/trunk/etc/default/couchdb:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817277-817278,817398,817400,817403,817749,817793,818249,818357,819091,819341,819343,819436,819799,819977,820344,820469,820495,820851,825407
+/couchdb/trunk/etc/default/couchdb:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817277-817278,817398,817400,817403,817749,817793,818249,818357,819091,819341,819343,819436,819799,819977,820344,820469,820495,820851,825407,826692
/incubator/couchdb/trunk/etc/default/couchdb:642419-694440
Modified: couchdb/branches/0.10.x/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/share/www/script/test/list_views.js?rev=826693&r1=826692&r2=826693&view=diff
==============================================================================
--- couchdb/branches/0.10.x/share/www/script/test/list_views.js (original)
+++ couchdb/branches/0.10.x/share/www/script/test/list_views.js Mon Oct 19 14:51:58 2009
@@ -177,6 +177,23 @@
}
}
};
+ var erlListDoc = {
+ _id: "_design/erlang",
+ language: "erlang",
+ lists: {
+ simple:
+ 'fun(Head, {Req}) -> ' +
+ ' Send(<<"[">>), ' +
+ ' Fun = fun({Row}, Sep) -> ' +
+ ' Val = proplists:get_value(<<"key">>, Row, 23), ' +
+ ' Send(list_to_binary(Sep ++ integer_to_list(Val))), ' +
+ ' {ok, ","} ' +
+ ' end, ' +
+ ' {ok, _} = FoldRows(Fun, ""), ' +
+ ' Send(<<"]">>) ' +
+ 'end.'
+ }
+ };
T(db.save(designDoc).ok);
@@ -373,10 +390,33 @@
// Test we can run lists and views from separate docs.
T(db.save(viewOnlyDesignDoc).ok);
- xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/simpleForm/views/basicView?startkey=-3");
- T(xhr.status == 200, "with query params");
+ var url = "/test_suite_db/_design/lists/_list/simpleForm/views/basicView" +
+ "?startkey=-3";
+ xhr = CouchDB.request("GET", url);
+ T(xhr.status == 200, "multiple design docs.");
T(/Total Rows/.test(xhr.responseText));
T(!(/Key: -4/.test(xhr.responseText)));
T(/FirstKey: -3/.test(xhr.responseText));
T(/LastKey: 0/.test(xhr.responseText));
+
+ var erlViewTest = function() {
+ T(db.save(erlListDoc).ok);
+ var url = "/test_suite_db/_design/erlang/_list/simple/views/basicView" +
+ "?startkey=-3";
+ xhr = CouchDB.request("GET", url);
+ T(xhr.status == 200, "multiple languages in design docs.");
+ var list = JSON.parse(xhr.responseText);
+ T(list.length == 4);
+ for(var i = 0; i < list.length; i++)
+ {
+ T(list[i] + 3 == i);
+ }
+ };
+
+ run_on_modified_server([{
+ section: "native_query_servers",
+ key: "erlang",
+ value: "{couch_native_process, start_link, []}"
+ }], erlViewTest);
+
};
Modified: couchdb/branches/0.10.x/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_httpd_show.erl?rev=826693&r1=826692&r2=826693&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_httpd_show.erl Mon Oct 19 14:51:58 2009
@@ -124,16 +124,14 @@
#doc{body={ListProps}} = couch_httpd_db:couch_doc_open(Db, ListDesignId, nil, []),
if
ViewDesignName == ListDesignName ->
- ViewProps = ListProps,
ViewDesignId = ListDesignId;
true ->
- ViewDesignId = <<"_design/", ViewDesignName/binary>>,
- #doc{body={ViewProps}} = couch_httpd_db:couch_doc_open(Db, ViewDesignId, nil, [])
+ ViewDesignId = <<"_design/", ViewDesignName/binary>>
end,
- ViewLang = proplists:get_value(<<"language">>, ViewProps, <<"javascript">>),
+ ListLang = proplists:get_value(<<"language">>, ListProps, <<"javascript">>),
ListSrc = couch_util:get_nested_json_value({ListProps}, [<<"lists">>, ListName]),
- send_view_list_response(ViewLang, ListSrc, ViewName, ViewDesignId, Req, Db, Keys).
+ send_view_list_response(ListLang, ListSrc, ViewName, ViewDesignId, Req, Db, Keys).
send_view_list_response(Lang, ListSrc, ViewName, DesignId, Req, Db, Keys) ->