You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2010/05/04 04:01:02 UTC

svn commit: r940708 - in /couchdb/trunk: share/www/script/test/ src/couchdb/ test/etap/ test/view_server/

Author: kocolosk
Date: Tue May  4 02:01:00 2010
New Revision: 940708

URL: http://svn.apache.org/viewvc?rev=940708&view=rev
Log:
use keysearch BIF to search ejson props. Closes COUCHDB-747

Modified:
    couchdb/trunk/share/www/script/test/changes.js
    couchdb/trunk/share/www/script/test/erlang_views.js
    couchdb/trunk/share/www/script/test/list_views.js
    couchdb/trunk/src/couchdb/couch_btree.erl
    couchdb/trunk/src/couchdb/couch_db.erl
    couchdb/trunk/src/couchdb/couch_doc.erl
    couchdb/trunk/src/couchdb/couch_httpd.erl
    couchdb/trunk/src/couchdb/couch_httpd_auth.erl
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_httpd_oauth.erl
    couchdb/trunk/src/couchdb/couch_httpd_rewrite.erl
    couchdb/trunk/src/couchdb/couch_httpd_show.erl
    couchdb/trunk/src/couchdb/couch_httpd_stats_handlers.erl
    couchdb/trunk/src/couchdb/couch_httpd_view.erl
    couchdb/trunk/src/couchdb/couch_native_process.erl
    couchdb/trunk/src/couchdb/couch_query_servers.erl
    couchdb/trunk/src/couchdb/couch_rep.erl
    couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
    couchdb/trunk/src/couchdb/couch_rep_httpc.erl
    couchdb/trunk/src/couchdb/couch_rep_missing_revs.erl
    couchdb/trunk/src/couchdb/couch_rep_writer.erl
    couchdb/trunk/src/couchdb/couch_server.erl
    couchdb/trunk/src/couchdb/couch_stream.erl
    couchdb/trunk/src/couchdb/couch_util.erl
    couchdb/trunk/src/couchdb/couch_view.erl
    couchdb/trunk/src/couchdb/couch_view_group.erl
    couchdb/trunk/src/couchdb/couch_view_updater.erl
    couchdb/trunk/test/etap/090-task-status.t
    couchdb/trunk/test/etap/110-replication-httpc.t
    couchdb/trunk/test/etap/111-replication-changes-feed.t
    couchdb/trunk/test/etap/121-stats-aggregates.t
    couchdb/trunk/test/etap/140-attachment-comp.t
    couchdb/trunk/test/view_server/query_server_spec.rb

Modified: couchdb/trunk/share/www/script/test/changes.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/changes.js?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/changes.js (original)
+++ couchdb/trunk/share/www/script/test/changes.js Tue May  4 02:01:00 2010
@@ -360,7 +360,7 @@ couchTests.changes = function(debug) {
       filters: {
         foo:
           'fun({Doc}, Req) -> ' +
-          '  Value = proplists:get_value(<<"value">>, Doc),' +
+          '  Value = couch_util:get_value(<<"value">>, Doc),' +
           '  (Value rem 2) =:= 0' +
           'end.'
       }

Modified: couchdb/trunk/share/www/script/test/erlang_views.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/erlang_views.js?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/erlang_views.js (original)
+++ couchdb/trunk/share/www/script/test/erlang_views.js Tue May  4 02:01:00 2010
@@ -29,8 +29,8 @@ couchTests.erlang_views = function(debug
       T(db.save(doc).ok);
 
       var mfun = 'fun({Doc}) -> ' +
-                 ' K = proplists:get_value(<<"integer">>, Doc, null), ' +
-                 ' V = proplists:get_value(<<"string">>, Doc, null), ' +
+                 ' K = couch_util:get_value(<<"integer">>, Doc, null), ' +
+                 ' V = couch_util:get_value(<<"string">>, Doc, null), ' +
                  ' Emit(K, V) ' +
                  'end.';
 
@@ -55,9 +55,9 @@ couchTests.erlang_views = function(debug
         shows: {
           simple:
             'fun(Doc, {Req}) -> ' +
-            '  {Info} = proplists:get_value(<<"info">>, Req, {[]}), ' +
-            '  Purged = proplists:get_value(<<"purge_seq">>, Info, -1), ' +
-            '  Verb = proplists:get_value(<<"method">>, Req, <<"not_get">>), ' +
+            '  {Info} = couch_util:get_value(<<"info">>, Req, {[]}), ' +
+            '  Purged = couch_util:get_value(<<"purge_seq">>, Info, -1), ' +
+            '  Verb = couch_util:get_value(<<"method">>, Req, <<"not_get">>), ' +
             '  R = list_to_binary(io_lib:format("~b - ~s", [Purged, Verb])), ' +
             '  {[{<<"code">>, 200}, {<<"headers">>, {[]}}, {<<"body">>, R}]} ' +
             'end.'
@@ -67,7 +67,7 @@ couchTests.erlang_views = function(debug
             'fun(Head, {Req}) -> ' +
             '  Send(<<"head">>), ' +
             '  Fun = fun({Row}, _) -> ' +
-            '    Val = proplists:get_value(<<"value">>, Row, -1), ' +
+            '    Val = couch_util:get_value(<<"value">>, Row, -1), ' +
             '    Send(list_to_binary(integer_to_list(Val))), ' +
             '    {ok, nil} ' +
             '  end, ' +
@@ -117,10 +117,10 @@ couchTests.erlang_views = function(debug
       T(db.bulkSave(docs).length, 250, "Saved big doc set.");
       
       var mfun = 'fun({Doc}) -> ' +
-        'Words = proplists:get_value(<<"words">>, Doc), ' +
+        'Words = couch_util:get_value(<<"words">>, Doc), ' +
         'lists:foreach(fun({Word}) -> ' +
-            'WordString = proplists:get_value(<<"word">>, Word), ' + 
-            'Count = proplists:get_value(<<"count">>, Word), ' + 
+            'WordString = couch_util:get_value(<<"word">>, Word), ' + 
+            'Count = couch_util:get_value(<<"count">>, Word), ' + 
             'Emit(WordString , Count) ' +
           'end, Words) ' +
         'end.';

Modified: couchdb/trunk/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/list_views.js?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/list_views.js (original)
+++ couchdb/trunk/share/www/script/test/list_views.js Tue May  4 02:01:00 2010
@@ -178,7 +178,7 @@ couchTests.list_views = function(debug) 
             'fun(Head, {Req}) -> ' +
             '  Send(<<"[">>), ' +
             '  Fun = fun({Row}, Sep) -> ' +
-            '    Val = proplists:get_value(<<"key">>, Row, 23), ' +
+            '    Val = couch_util:get_value(<<"key">>, Row, 23), ' +
             '    Send(list_to_binary(Sep ++ integer_to_list(Val))), ' +
             '    {ok, ","} ' +
             '  end, ' +

Modified: couchdb/trunk/src/couchdb/couch_btree.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_btree.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_btree.erl (original)
+++ couchdb/trunk/src/couchdb/couch_btree.erl Tue May  4 02:01:00 2010
@@ -70,10 +70,10 @@ final_reduce(Reduce, {KVs, Reductions}) 
     final_reduce(Reduce, {[], [Red | Reductions]}).
 
 fold_reduce(#btree{root=Root}=Bt, Fun, Acc, Options) ->
-    Dir = proplists:get_value(dir, Options, fwd),
-    StartKey = proplists:get_value(start_key, Options),
-    EndKey = proplists:get_value(end_key, Options),
-    KeyGroupFun = proplists:get_value(key_group_fun, Options, fun(_,_) -> true end),
+    Dir = couch_util:get_value(dir, Options, fwd),
+    StartKey = couch_util:get_value(start_key, Options),
+    EndKey = couch_util:get_value(end_key, Options),
+    KeyGroupFun = couch_util:get_value(key_group_fun, Options, fun(_,_) -> true end),
     {StartKey2, EndKey2} =
     case Dir of
         rev -> {EndKey, StartKey};
@@ -107,9 +107,9 @@ convert_fun_arity(Fun) when is_function(
     Fun.    % Already arity 3
 
 make_key_in_end_range_function(#btree{less=Less}, fwd, Options) ->
-    case proplists:get_value(end_key_gt, Options) of
+    case couch_util:get_value(end_key_gt, Options) of
     undefined ->
-        case proplists:get_value(end_key, Options) of
+        case couch_util:get_value(end_key, Options) of
         undefined ->
             fun(_Key) -> true end;
         LastKey ->
@@ -119,9 +119,9 @@ make_key_in_end_range_function(#btree{le
         fun(Key) -> Less(Key, EndKey) end
     end;
 make_key_in_end_range_function(#btree{less=Less}, rev, Options) ->
-    case proplists:get_value(end_key_gt, Options) of
+    case couch_util:get_value(end_key_gt, Options) of
     undefined ->
-        case proplists:get_value(end_key, Options) of
+        case couch_util:get_value(end_key, Options) of
         undefined ->
             fun(_Key) -> true end;
         LastKey ->
@@ -142,10 +142,10 @@ foldl(Bt, Fun, Acc, Options) ->
 fold(#btree{root=nil}, _Fun, Acc, _Options) ->
     {ok, {[], []}, Acc};
 fold(#btree{root=Root}=Bt, Fun, Acc, Options) ->
-    Dir = proplists:get_value(dir, Options, fwd),
+    Dir = couch_util:get_value(dir, Options, fwd),
     InRange = make_key_in_end_range_function(Bt, Dir, Options),
     Result =
-    case proplists:get_value(start_key, Options) of
+    case couch_util:get_value(start_key, Options) of
     undefined ->
         stream_node(Bt, [], Bt#btree.root, InRange, Dir, 
                 convert_fun_arity(Fun), Acc);

Modified: couchdb/trunk/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db.erl Tue May  4 02:01:00 2010
@@ -239,8 +239,8 @@ get_design_docs(#db{fulldocinfo_by_id_bt
 
 check_is_admin(#db{user_ctx=#user_ctx{name=Name,roles=Roles}}=Db) ->
     {Admins} = get_admins(Db),
-    AdminRoles = [<<"_admin">> | proplists:get_value(<<"roles">>, Admins, [])],
-    AdminNames = proplists:get_value(<<"names">>, Admins,[]),
+    AdminRoles = [<<"_admin">> | couch_util:get_value(<<"roles">>, Admins, [])],
+    AdminNames = couch_util:get_value(<<"names">>, Admins,[]),
     case AdminRoles -- Roles of
     AdminRoles -> % same list, not an admin role
         case AdminNames -- [Name] of
@@ -258,9 +258,9 @@ check_is_reader(#db{user_ctx=#user_ctx{n
     ok -> ok;
     _ ->
         {Readers} = get_readers(Db),
-        ReaderRoles = proplists:get_value(<<"roles">>, Readers,[]),
+        ReaderRoles = couch_util:get_value(<<"roles">>, Readers,[]),
         WithAdminRoles = [<<"_admin">> | ReaderRoles],
-        ReaderNames = proplists:get_value(<<"names">>, Readers,[]),
+        ReaderNames = couch_util:get_value(<<"names">>, Readers,[]),
         case ReaderRoles ++ ReaderNames of 
         [] -> ok; % no readers == public access
         _Else ->
@@ -280,10 +280,10 @@ check_is_reader(#db{user_ctx=#user_ctx{n
     end.
 
 get_admins(#db{security=SecProps}) ->
-    proplists:get_value(<<"admins">>, SecProps, {[]}).
+    couch_util:get_value(<<"admins">>, SecProps, {[]}).
 
 get_readers(#db{security=SecProps}) ->
-    proplists:get_value(<<"readers">>, SecProps, {[]}).
+    couch_util:get_value(<<"readers">>, SecProps, {[]}).
 
 get_security(#db{security=SecProps}) ->
     {SecProps}.
@@ -298,21 +298,21 @@ set_security(_, _) ->
     throw(bad_request).
 
 validate_security_object(SecProps) ->
-    Admins = proplists:get_value(<<"admins">>, SecProps, {[]}),
-    Readers = proplists:get_value(<<"readers">>, SecProps, {[]}),
+    Admins = couch_util:get_value(<<"admins">>, SecProps, {[]}),
+    Readers = couch_util:get_value(<<"readers">>, SecProps, {[]}),
     ok = validate_names_and_roles(Admins),
     ok = validate_names_and_roles(Readers),
     ok.
 
 % validate user input
 validate_names_and_roles({Props}) when is_list(Props) ->
-    case proplists:get_value(<<"names">>,Props,[]) of
+    case couch_util:get_value(<<"names">>,Props,[]) of
     Ns when is_list(Ns) ->
             [throw("names must be a JSON list of strings") ||N <- Ns, not is_binary(N)],
             Ns;
     _ -> throw("names must be a JSON list of strings")
     end,
-    case proplists:get_value(<<"roles">>,Props,[]) of
+    case couch_util:get_value(<<"roles">>,Props,[]) of
     Rs when is_list(Rs) ->
         [throw("roles must be a JSON list of strings") ||R <- Rs, not is_binary(R)],
         Rs;

Modified: couchdb/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_doc.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_doc.erl Tue May  4 02:01:00 2010
@@ -79,7 +79,7 @@ to_json_attachments(Attachments, Options
     false ->
         % note the default is [], because this sorts higher than all numbers.
         % and will return all the binaries.
-        proplists:get_value(atts_after_revpos, Options, [])
+        couch_util:get_value(atts_after_revpos, Options, [])
     end,
     to_json_attachments(
         Attachments,
@@ -203,26 +203,26 @@ transfer_fields([{<<"_rev">>, _Rev} | Re
 
 transfer_fields([{<<"_attachments">>, {JsonBins}} | Rest], Doc) ->
     Atts = lists:map(fun({Name, {BinProps}}) ->
-        case proplists:get_value(<<"stub">>, BinProps) of
+        case couch_util:get_value(<<"stub">>, BinProps) of
         true ->
-            Type = proplists:get_value(<<"content_type">>, BinProps),
-            RevPos = proplists:get_value(<<"revpos">>, BinProps, 0),
-            DiskLen = proplists:get_value(<<"length">>, BinProps),
+            Type = couch_util:get_value(<<"content_type">>, BinProps),
+            RevPos = couch_util:get_value(<<"revpos">>, BinProps, 0),
+            DiskLen = couch_util:get_value(<<"length">>, BinProps),
             {Enc, EncLen} = att_encoding_info(BinProps),
             #att{name=Name, data=stub, type=Type, att_len=EncLen,
                 disk_len=DiskLen, encoding=Enc, revpos=RevPos};
         _ ->
-            Type = proplists:get_value(<<"content_type">>, BinProps,
+            Type = couch_util:get_value(<<"content_type">>, BinProps,
                     ?DEFAULT_ATTACHMENT_CONTENT_TYPE),
-            RevPos = proplists:get_value(<<"revpos">>, BinProps, 0),
-            case proplists:get_value(<<"follows">>, BinProps) of
+            RevPos = couch_util:get_value(<<"revpos">>, BinProps, 0),
+            case couch_util:get_value(<<"follows">>, BinProps) of
             true ->
-                DiskLen = proplists:get_value(<<"length">>, BinProps),
+                DiskLen = couch_util:get_value(<<"length">>, BinProps),
                 {Enc, EncLen} = att_encoding_info(BinProps),
                 #att{name=Name, data=follows, type=Type, encoding=Enc,
                     att_len=EncLen, disk_len=DiskLen, revpos=RevPos};
             _ ->
-                Value = proplists:get_value(<<"data">>, BinProps),
+                Value = couch_util:get_value(<<"data">>, BinProps),
                 Bin = base64:decode(Value),
                 LenBin = size(Bin),
                 #att{name=Name, data=Bin, type=Type, att_len=LenBin,
@@ -233,8 +233,8 @@ transfer_fields([{<<"_attachments">>, {J
     transfer_fields(Rest, Doc#doc{atts=Atts});
 
 transfer_fields([{<<"_revisions">>, {Props}} | Rest], Doc) ->
-    RevIds = proplists:get_value(<<"ids">>, Props),
-    Start = proplists:get_value(<<"start">>, Props),
+    RevIds = couch_util:get_value(<<"ids">>, Props),
+    Start = couch_util:get_value(<<"start">>, Props),
     if not is_integer(Start) ->
         throw({doc_validation, "_revisions.start isn't an integer."});
     not is_list(RevIds) ->
@@ -269,12 +269,12 @@ transfer_fields([Field | Rest], #doc{bod
     transfer_fields(Rest, Doc#doc{body=[Field|Fields]}).
 
 att_encoding_info(BinProps) ->
-    DiskLen = proplists:get_value(<<"length">>, BinProps),
-    case proplists:get_value(<<"encoding">>, BinProps) of
+    DiskLen = couch_util:get_value(<<"length">>, BinProps),
+    case couch_util:get_value(<<"encoding">>, BinProps) of
     undefined ->
         {identity, DiskLen};
     Enc ->
-        EncodedLen = proplists:get_value(<<"encoded_length">>, BinProps, DiskLen),
+        EncodedLen = couch_util:get_value(<<"encoded_length">>, BinProps, DiskLen),
         {list_to_atom(?b2l(Enc)), EncodedLen}
     end.
 
@@ -341,7 +341,7 @@ att_to_bin(#att{data=DataFun, att_len=Le
     ).
 
 get_validate_doc_fun(#doc{body={Props}}=DDoc) ->
-    case proplists:get_value(<<"validate_doc_update">>, Props) of
+    case couch_util:get_value(<<"validate_doc_update">>, Props) of
     undefined ->
         nil;
     _Else ->
@@ -458,7 +458,7 @@ doc_from_multi_part_stream(ContentType, 
     Doc#doc{atts=Atts2}.
 
 mp_parse_doc({headers, H}, []) ->
-    {"application/json", _} = proplists:get_value("content-type", H),
+    {"application/json", _} = couch_util:get_value("content-type", H),
     fun (Next) ->
         mp_parse_doc(Next, [])
     end;

Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd.erl Tue May  4 02:01:00 2010
@@ -163,7 +163,7 @@ handle_request(MochiReq, DefaultFun,
     Vhost = MochiReq:get_header_value("Host"),
 
     % find Vhost in config
-    case proplists:get_value(Vhost, VirtualHosts) of
+    case couch_util:get_value(Vhost, VirtualHosts) of
         undefined -> % business as usual
             handle_request_int(MochiReq, DefaultFun,
                     UrlHandlers, DbUrlHandlers, DesignUrlHandlers);
@@ -336,7 +336,7 @@ qs_value(Req, Key) ->
     qs_value(Req, Key, undefined).
 
 qs_value(Req, Key, Default) ->
-    proplists:get_value(Key, qs(Req), Default).
+    couch_util:get_value(Key, qs(Req), Default).
 
 qs(#httpd{mochi_req=MochiReq}) ->
     MochiReq:parse_qs().
@@ -742,7 +742,7 @@ nil_callback(_Data)->
 
 get_boundary(ContentType) ->
     {"multipart/" ++ _, Opts} = mochiweb_util:parse_header(ContentType),
-    case proplists:get_value("boundary", Opts) of
+    case couch_util:get_value("boundary", Opts) of
         S when is_list(S) ->
             S
     end.

Modified: couchdb/trunk/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_auth.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_auth.erl Tue May  4 02:01:00 2010
@@ -70,14 +70,14 @@ default_authentication_handler(Req) ->
             nil ->
                 throw({unauthorized, <<"Name or password is incorrect.">>});
             UserProps ->
-                UserSalt = proplists:get_value(<<"salt">>, UserProps, <<>>),
+                UserSalt = couch_util:get_value(<<"salt">>, UserProps, <<>>),
                 PasswordHash = hash_password(?l2b(Pass), UserSalt),
-                ExpectedHash = proplists:get_value(<<"password_sha">>, UserProps, nil),
+                ExpectedHash = couch_util:get_value(<<"password_sha">>, UserProps, nil),
                 case couch_util:verify(ExpectedHash, PasswordHash) of
                     true ->
                         Req#httpd{user_ctx=#user_ctx{
                             name=?l2b(User),
-                            roles=proplists:get_value(<<"roles">>, UserProps, [])
+                            roles=couch_util:get_value(<<"roles">>, UserProps, [])
                         }};
                     _Else ->
                         throw({unauthorized, <<"Name or password is incorrect.">>})
@@ -170,7 +170,7 @@ get_user(UserName) ->
                   {<<"salt">>, ?l2b(Salt)},
                   {<<"password_sha">>, ?l2b(HashedPwd)}];
             UserProps when is_list(UserProps) ->
-                DocRoles = proplists:get_value(<<"roles">>, UserProps),
+                DocRoles = couch_util:get_value(<<"roles">>, UserProps),
                 [{<<"roles">>, [<<"_admin">> | DocRoles]},
                   {<<"salt">>, ?l2b(Salt)},
                   {<<"password_sha">>, ?l2b(HashedPwd)}]
@@ -186,10 +186,10 @@ get_user_props_from_db(UserName) ->
     try couch_httpd_db:couch_doc_open(Db, DocId, nil, [conflicts]) of
         #doc{meta=Meta}=Doc ->
             %  check here for conflict state and throw error if conflicted
-            case proplists:get_value(conflicts,Meta,[]) of
+            case couch_util:get_value(conflicts,Meta,[]) of
                 [] -> 
                     {DocProps} = couch_query_servers:json_doc(Doc),
-                    case proplists:get_value(<<"type">>, DocProps) of
+                    case couch_util:get_value(<<"type">>, DocProps) of
                         <<"user">> ->
                             DocProps;
                         _Else -> 
@@ -324,7 +324,7 @@ cookie_authentication_handler(#httpd{moc
             case get_user(?l2b(User)) of
             nil -> Req;
             UserProps ->
-                UserSalt = proplists:get_value(<<"salt">>, UserProps, <<"">>),
+                UserSalt = couch_util:get_value(<<"salt">>, UserProps, <<"">>),
                 FullSecret = <<Secret/binary, UserSalt/binary>>,
                 ExpectedHash = crypto:sha_mac(FullSecret, User ++ ":" ++ TimeStr),
                 Hash = ?l2b(string:join(HashParts, ":")),
@@ -338,7 +338,7 @@ cookie_authentication_handler(#httpd{moc
                                 ?LOG_DEBUG("Successful cookie auth as: ~p", [User]),
                                 Req#httpd{user_ctx=#user_ctx{
                                     name=?l2b(User),
-                                    roles=proplists:get_value(<<"roles">>, UserProps, [])
+                                    roles=couch_util:get_value(<<"roles">>, UserProps, [])
                                 }, auth={FullSecret, TimeLeft < Timeout*0.9}};
                             _Else ->
                                 Req
@@ -359,9 +359,9 @@ cookie_auth_header(#httpd{user_ctx=#user
     %    or logout handler.
     % The login and logout handlers need to set the AuthSession cookie
     % themselves.
-    CookieHeader = proplists:get_value("Set-Cookie", Headers, ""),
+    CookieHeader = couch_util:get_value("Set-Cookie", Headers, ""),
     Cookies = mochiweb_cookies:parse_cookie(CookieHeader),
-    AuthSession = proplists:get_value("AuthSession", Cookies),
+    AuthSession = couch_util:get_value("AuthSession", Cookies),
     if AuthSession == undefined ->
         TimeStamp = make_cookie_time(),
         [cookie_auth_cookie(?b2l(User), Secret, TimeStamp)];
@@ -400,16 +400,16 @@ handle_session_req(#httpd{method='POST',
         _ ->
             []
     end,
-    UserName = ?l2b(proplists:get_value("name", Form, "")),
-    Password = ?l2b(proplists:get_value("password", Form, "")),
+    UserName = ?l2b(couch_util:get_value("name", Form, "")),
+    Password = ?l2b(couch_util:get_value("password", Form, "")),
     ?LOG_DEBUG("Attempt Login: ~s",[UserName]),
     User = case get_user(UserName) of
         nil -> [];
         Result -> Result
     end,
-    UserSalt = proplists:get_value(<<"salt">>, User, <<>>),
+    UserSalt = couch_util:get_value(<<"salt">>, User, <<>>),
     PasswordHash = hash_password(Password, UserSalt),
-    ExpectedHash = proplists:get_value(<<"password_sha">>, User, nil),
+    ExpectedHash = couch_util:get_value(<<"password_sha">>, User, nil),
     case couch_util:verify(ExpectedHash, PasswordHash) of
         true ->
             % setup the session cookie
@@ -426,8 +426,8 @@ handle_session_req(#httpd{method='POST',
             send_json(Req#httpd{req_body=ReqBody}, Code, Headers,
                 {[
                     {ok, true},
-                    {name, proplists:get_value(<<"name">>, User, null)},
-                    {roles, proplists:get_value(<<"roles">>, User, [])}
+                    {name, couch_util:get_value(<<"name">>, User, null)},
+                    {roles, couch_util:get_value(<<"roles">>, User, [])}
                 ]});
         _Else ->
             % clear the session

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Tue May  4 02:01:00 2010
@@ -283,7 +283,7 @@ db_req(#httpd{path_parts=[_,<<"_ensure_f
 db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>]}=Req, Db) ->
     couch_stats_collector:increment({httpd, bulk_requests}),
     {JsonProps} = couch_httpd:json_body_obj(Req),
-    DocsArray = proplists:get_value(<<"docs">>, JsonProps),
+    DocsArray = couch_util:get_value(<<"docs">>, JsonProps),
     case couch_httpd:header_value(Req, "X-Couch-Full-Commit") of
     "true" ->
         Options = [full_commit];
@@ -292,7 +292,7 @@ db_req(#httpd{method='POST',path_parts=[
     _ ->
         Options = []
     end,
-    case proplists:get_value(<<"new_edits">>, JsonProps, true) of
+    case couch_util:get_value(<<"new_edits">>, JsonProps, true) of
     true ->
         Docs = lists:map(
             fun({ObjProps} = JsonObj) ->
@@ -302,7 +302,7 @@ db_req(#httpd{method='POST',path_parts=[
                     <<>> -> couch_uuids:new();
                     Id0 -> Id0
                 end,
-                case proplists:get_value(<<"_rev">>, ObjProps) of
+                case couch_util:get_value(<<"_rev">>, ObjProps) of
                 undefined ->
                     Revs = {0, []};
                 Rev  ->
@@ -313,7 +313,7 @@ db_req(#httpd{method='POST',path_parts=[
             end,
             DocsArray),
         Options2 =
-        case proplists:get_value(<<"all_or_nothing">>, JsonProps) of
+        case couch_util:get_value(<<"all_or_nothing">>, JsonProps) of
         true  -> [all_or_nothing|Options];
         _ -> Options
         end,
@@ -362,7 +362,7 @@ db_req(#httpd{method='GET',path_parts=[_
 
 db_req(#httpd{method='POST',path_parts=[_,<<"_all_docs">>]}=Req, Db) ->
     {Fields} = couch_httpd:json_body_obj(Req),
-    case proplists:get_value(<<"keys">>, Fields, nil) of
+    case couch_util:get_value(<<"keys">>, Fields, nil) of
     nil ->
         ?LOG_DEBUG("POST to _all_docs with no keys member.", []),
         all_docs_view(Req, Db, nil);
@@ -484,7 +484,7 @@ all_docs_view(Req, Db, Keys) ->
     CurrentEtag = couch_httpd:make_etag(Info),
     couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
 
-        TotalRowCount = proplists:get_value(doc_count, Info),
+        TotalRowCount = couch_util:get_value(doc_count, Info),
         StartId = if is_binary(StartKey) -> StartKey;
         true -> StartDocId
         end,
@@ -609,10 +609,10 @@ db_doc_req(#httpd{method='POST'}=Req, Db
     Form = couch_httpd:parse_form(Req),
     case proplists:is_defined("_doc", Form) of
     true ->
-        Json = ?JSON_DECODE(proplists:get_value("_doc", Form)),
+        Json = ?JSON_DECODE(couch_util:get_value("_doc", Form)),
         Doc = couch_doc_from_req(Req, DocId, Json);
     false ->
-        Rev = couch_doc:parse_rev(list_to_binary(proplists:get_value("_rev", Form))),
+        Rev = couch_doc:parse_rev(list_to_binary(couch_util:get_value("_rev", Form))),
         {ok, [{ok, Doc}]} = couch_db:open_doc_revs(Db, DocId, [Rev], [])
     end,
     UpdatedAtts = [
@@ -740,7 +740,7 @@ send_doc_efficiently(Req, #doc{atts=Atts
         true ->
             Boundary = couch_uuids:random(),
             JsonBytes = ?JSON_ENCODE(couch_doc:to_json_obj(Doc, [follows|Options])),
-            AttsSinceRevPos = proplists:get_value(atts_after_revpos, Options, 0),
+            AttsSinceRevPos = couch_util:get_value(atts_after_revpos, Options, 0),
             Len = couch_doc:len_doc_to_multi_part_stream(Boundary,JsonBytes,Atts,
                     AttsSinceRevPos,false),
             CType = {<<"Content-Type">>, 

Modified: couchdb/trunk/src/couchdb/couch_httpd_oauth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_oauth.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_oauth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_oauth.erl Tue May  4 02:01:00 2010
@@ -18,7 +18,7 @@
 % OAuth auth handler using per-node user db
 oauth_authentication_handler(#httpd{mochi_req=MochiReq}=Req) ->
     serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
-        AccessToken = proplists:get_value("oauth_token", Params),
+        AccessToken = couch_util:get_value("oauth_token", Params),
         case couch_config:get("oauth_token_secrets", AccessToken) of
             undefined -> 
                 couch_httpd:send_error(Req, 400, <<"invalid_token">>,
@@ -44,14 +44,14 @@ set_user_ctx(Req, AccessToken) ->
     case couch_httpd_auth:get_user(Name) of
         nil -> Req;
         User ->
-            Roles = proplists:get_value(<<"roles">>, User, []),
+            Roles = couch_util:get_value(<<"roles">>, User, []),
             Req#httpd{user_ctx=#user_ctx{name=Name, roles=Roles}}
     end.
 
 % OAuth request_token
 handle_oauth_req(#httpd{path_parts=[_OAuth, <<"request_token">>], method=Method}=Req) ->
     serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
-        AccessToken = proplists:get_value("oauth_token", Params),
+        AccessToken = couch_util:get_value("oauth_token", Params),
         TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
         case oauth:verify(Signature, atom_to_list(Method), URL, Params, Consumer, TokenSecret) of
             true ->
@@ -88,7 +88,7 @@ serve_oauth_authorize(#httpd{method=Meth
         'GET' ->
             % Confirm with the User that they want to authenticate the Consumer
             serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
-                AccessToken = proplists:get_value("oauth_token", Params),
+                AccessToken = couch_util:get_value("oauth_token", Params),
                 TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
                 case oauth:verify(Signature, "GET", URL, Params, Consumer, TokenSecret) of
                     true ->
@@ -100,7 +100,7 @@ serve_oauth_authorize(#httpd{method=Meth
         'POST' ->
             % If the User has confirmed, we direct the User back to the Consumer with a verification code
             serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
-                AccessToken = proplists:get_value("oauth_token", Params),
+                AccessToken = couch_util:get_value("oauth_token", Params),
                 TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
                 case oauth:verify(Signature, "POST", URL, Params, Consumer, TokenSecret) of
                     true ->
@@ -129,24 +129,24 @@ serve_oauth(#httpd{mochi_req=MochiReq}=R
             end
     end,
     HeaderParams = oauth_uri:params_from_header_string(AuthHeader),
-    %Realm = proplists:get_value("realm", HeaderParams),
+    %Realm = couch_util:get_value("realm", HeaderParams),
     Params = proplists:delete("realm", HeaderParams) ++ MochiReq:parse_qs(),
     ?LOG_DEBUG("OAuth Params: ~p", [Params]),
-    case proplists:get_value("oauth_version", Params, "1.0") of
+    case couch_util:get_value("oauth_version", Params, "1.0") of
         "1.0" ->
-            case proplists:get_value("oauth_consumer_key", Params, undefined) of
+            case couch_util:get_value("oauth_consumer_key", Params, undefined) of
                 undefined ->
                     case FailSilently of
                         true -> Req;
                         false -> couch_httpd:send_error(Req, 400, <<"invalid_consumer">>, <<"Invalid consumer.">>)
                     end;
                 ConsumerKey ->
-                    SigMethod = proplists:get_value("oauth_signature_method", Params),
+                    SigMethod = couch_util:get_value("oauth_signature_method", Params),
                     case consumer_lookup(ConsumerKey, SigMethod) of
                         none ->
                             couch_httpd:send_error(Req, 400, <<"invalid_consumer">>, <<"Invalid consumer (key or signature method).">>);
                         Consumer ->
-                            Signature = proplists:get_value("oauth_signature", Params),
+                            Signature = couch_util:get_value("oauth_signature", Params),
                             URL = couch_httpd:absolute_uri(Req, MochiReq:get(raw_path)),
                             Fun(URL, proplists:delete("oauth_signature", Params),
                                 Consumer, Signature)

Modified: couchdb/trunk/src/couchdb/couch_httpd_rewrite.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_rewrite.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_rewrite.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_rewrite.erl Tue May  4 02:01:00 2010
@@ -122,7 +122,7 @@ handle_rewrite_req(#httpd{
     #doc{body={Props}} = DDoc,
 
     % get rules from ddoc
-    case proplists:get_value(<<"rewrites">>, Props) of
+    case couch_util:get_value(<<"rewrites">>, Props) of
         undefined ->
             couch_httpd:send_error(Req, 404, <<"rewrite_error">>,
                             <<"Invalid path.">>);
@@ -204,7 +204,7 @@ try_bind_path([Dispatch|Rest], Method, P
                     % QueryArgs1
                     Bindings2 = lists:foldl(fun({K, V}, Acc) ->
                         K1 = to_atom(K),
-                        KV = case proplists:get_value(K1, QueryArgs1) of
+                        KV = case couch_util:get_value(K1, QueryArgs1) of
                             undefined -> [{K1, V}];
                             _V1 -> []
                         end,
@@ -269,7 +269,7 @@ replace_var(Key, Value, Bindings) ->
 
 get_var(VarName, Props, Default) ->
     VarName1 = list_to_atom(binary_to_list(VarName)),
-    proplists:get_value(VarName1, Props, Default).
+    couch_util:get_value(VarName1, Props, Default).
 
 %% doc: build new patch from bindings. bindings are query args
 %% (+ dynamic query rewritten if needed) and bindings found in
@@ -283,7 +283,7 @@ make_new_path([?MATCH_ALL|_Rest], _Bindi
     Acc1 = lists:reverse(Acc) ++ Remaining,
     Acc1;
 make_new_path([P|Rest], Bindings, Remaining, Acc) when is_atom(P) ->
-    P2 = case proplists:get_value(P, Bindings) of
+    P2 = case couch_util:get_value(P, Bindings) of
         undefined -> << "undefined">>;
         P1 -> P1
     end,
@@ -343,20 +343,20 @@ normalize_path1([Path|Rest], Acc) ->
 
 %% @doc transform json rule in erlang for pattern matching
 make_rule(Rule) ->
-    Method = case proplists:get_value(<<"method">>, Rule) of
+    Method = case couch_util:get_value(<<"method">>, Rule) of
         undefined -> '*';
         M -> list_to_atom(?b2l(M))
     end,
-    QueryArgs = case proplists:get_value(<<"query">>, Rule) of
+    QueryArgs = case couch_util:get_value(<<"query">>, Rule) of
         undefined -> [];
         {Args} -> Args
         end,
-    FromParts  = case proplists:get_value(<<"from">>, Rule) of
+    FromParts  = case couch_util:get_value(<<"from">>, Rule) of
         undefined -> ['*'];
         From ->
             parse_path(From)
         end,
-    ToParts  = case proplists:get_value(<<"to">>, Rule) of
+    ToParts  = case couch_util:get_value(<<"to">>, Rule) of
         undefined ->
             throw({error, invalid_rewrite_target});
         To ->

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Tue May  4 02:01:00 2010
@@ -95,7 +95,7 @@ show_etag(#httpd{user_ctx=UserCtx}=Req, 
 
 get_fun_key(DDoc, Type, Name) ->
     #doc{body={Props}} = DDoc,
-    Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>),
+    Lang = couch_util:get_value(<<"language">>, Props, <<"javascript">>),
     Src = couch_util:get_nested_json_value({Props}, [Type, Name]),
     {Lang, Src}.
 
@@ -168,7 +168,7 @@ handle_view_list_req(#httpd{method='POST
     % {Props2} = couch_httpd:json_body(Req),
     ReqBody = couch_httpd:body(Req),
     {Props2} = ?JSON_DECODE(ReqBody),
-    Keys = proplists:get_value(<<"keys">>, Props2, nil),
+    Keys = couch_util:get_value(<<"keys">>, Props2, nil),
     handle_view_list(Req#httpd{req_body=ReqBody}, Db, DDoc, ListName, {DesignName, ViewName}, Keys);
 
 handle_view_list_req(#httpd{method='POST',
@@ -176,7 +176,7 @@ handle_view_list_req(#httpd{method='POST
     % {Props2} = couch_httpd:json_body(Req),
     ReqBody = couch_httpd:body(Req),
     {Props2} = ?JSON_DECODE(ReqBody),
-    Keys = proplists:get_value(<<"keys">>, Props2, nil),
+    Keys = couch_util:get_value(<<"keys">>, Props2, nil),
     handle_view_list(Req#httpd{req_body=ReqBody}, Db, DDoc, ListName, {ViewDesignName, ViewName}, Keys);
 
 handle_view_list_req(#httpd{method='POST'}=Req, _Db, _DDoc) ->
@@ -396,7 +396,7 @@ apply_etag({ExternalResponse}, CurrentEt
     % headers on the JsonResponse object. We need to control the Etag and
     % Vary headers. If the external function controls the Etag, we'd have to
     % run it to check for a match, which sort of defeats the purpose.
-    case proplists:get_value(<<"headers">>, ExternalResponse, nil) of
+    case couch_util:get_value(<<"headers">>, ExternalResponse, nil) of
     nil ->
         % no JSON headers
         % add our Etag and Vary headers to the response

Modified: couchdb/trunk/src/couchdb/couch_httpd_stats_handlers.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_stats_handlers.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_stats_handlers.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_stats_handlers.erl Tue May  4 02:01:00 2010
@@ -39,7 +39,7 @@ handle_stats_req(Req) ->
     send_method_not_allowed(Req, "GET").
 
 range(Req) ->
-    case proplists:get_value("range", couch_httpd:qs(Req)) of
+    case couch_util:get_value("range", couch_httpd:qs(Req)) of
         undefined ->
             0;
         Value ->
@@ -47,7 +47,7 @@ range(Req) ->
     end.
 
 flush(Req) ->
-    case proplists:get_value("flush", couch_httpd:qs(Req)) of
+    case couch_util:get_value("flush", couch_httpd:qs(Req)) of
         "true" ->
             couch_stats_aggregator:collect_sample();
         _Else ->

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Tue May  4 02:01:00 2010
@@ -62,7 +62,7 @@ handle_view_req(#httpd{method='GET',
 handle_view_req(#httpd{method='POST',
         path_parts=[_, _, DName, _, ViewName]}=Req, Db, _DDoc) ->
     {Fields} = couch_httpd:json_body_obj(Req),
-    case proplists:get_value(<<"keys">>, Fields, nil) of
+    case couch_util:get_value(<<"keys">>, Fields, nil) of
     nil ->
         Fmt = "POST to view ~p/~p in database ~p with no keys member.",
         ?LOG_DEBUG(Fmt, [DName, ViewName, Db]),
@@ -80,12 +80,12 @@ handle_temp_view_req(#httpd{method='POST
     ok = couch_db:check_is_admin(Db),
     couch_stats_collector:increment({httpd, temporary_view_reads}),
     {Props} = couch_httpd:json_body_obj(Req),
-    Language = proplists:get_value(<<"language">>, Props, <<"javascript">>),
-    {DesignOptions} = proplists:get_value(<<"options">>, Props, {[]}),
-    MapSrc = proplists:get_value(<<"map">>, Props),
-    Keys = proplists:get_value(<<"keys">>, Props, nil),
+    Language = couch_util:get_value(<<"language">>, Props, <<"javascript">>),
+    {DesignOptions} = couch_util:get_value(<<"options">>, Props, {[]}),
+    MapSrc = couch_util:get_value(<<"map">>, Props),
+    Keys = couch_util:get_value(<<"keys">>, Props, nil),
     Reduce = get_reduce_type(Req),
-    case proplists:get_value(<<"reduce">>, Props, null) of
+    case couch_util:get_value(<<"reduce">>, Props, null) of
     null ->
         QueryArgs = parse_view_params(Req, Keys, map),
         {ok, View, Group} = couch_view:get_temp_map_view(Db, Language,
@@ -576,13 +576,13 @@ view_row_obj(_Db, {{Key, error}, Value},
     {[{key, Key}, {error, Value}]};
 % include docs in the view output
 view_row_obj(Db, {{Key, DocId}, {Props}}, true) ->
-    Rev = case proplists:get_value(<<"_rev">>, Props) of
+    Rev = case couch_util:get_value(<<"_rev">>, Props) of
     undefined ->
         nil;
     Rev0 ->
         couch_doc:parse_rev(Rev0)
     end,
-    IncludeId = proplists:get_value(<<"_id">>, Props, DocId),
+    IncludeId = couch_util:get_value(<<"_id">>, Props, DocId),
     view_row_with_doc(Db, {{Key, DocId}, {Props}}, {IncludeId, Rev});
 view_row_obj(Db, {{Key, DocId}, Value}, true) ->
     view_row_with_doc(Db, {{Key, DocId}, Value}, {DocId, nil});

Modified: couchdb/trunk/src/couchdb/couch_native_process.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_native_process.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_native_process.erl (original)
+++ couchdb/trunk/src/couchdb/couch_native_process.erl Tue May  4 02:01:00 2010
@@ -25,7 +25,7 @@
 %
 %  fun({Doc}) ->
 %    % Below, we emit a single record - the _id as key, null as value
-%    DocId = proplists:get_value(Doc, <<"_id">>, null),
+%    DocId = couch_util:get_value(Doc, <<"_id">>, null),
 %    Emit(DocId, null)
 %  end.
 %
@@ -173,7 +173,7 @@ ddoc(State, {DDoc}, [FunPath, Args]) ->
     % load fun from the FunPath
     BFun = lists:foldl(fun
         (Key, {Props}) when is_list(Props) ->
-            proplists:get_value(Key, Props, nil);
+            couch_util:get_value(Key, Props, nil);
         (_Key, Fun) when is_binary(Fun) ->
             Fun;
         (_Key, nil) ->

Modified: couchdb/trunk/src/couchdb/couch_query_servers.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_query_servers.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_query_servers.erl (original)
+++ couchdb/trunk/src/couchdb/couch_query_servers.erl Tue May  4 02:01:00 2010
@@ -271,7 +271,7 @@ terminate(_Reason, {_Langs, PidProcs, _L
 
 handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, _From, {Langs, PidProcs, LangProcs}=Server) ->
     % Note to future self. Add max process limit.
-    Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>),    
+    Lang = couch_util:get_value(<<"language">>, Props, <<"javascript">>),    
     case ets:lookup(LangProcs, Lang) of
     [{Lang, [P|Rest]}] ->
         % find a proc in the set that has the DDoc

Modified: couchdb/trunk/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep.erl Tue May  4 02:01:00 2010
@@ -68,7 +68,7 @@ replicate({Props}=PostBody, UserCtx) ->
         [?MODULE]
     },
 
-    case proplists:get_value(<<"cancel">>, Props, false) of
+    case couch_util:get_value(<<"cancel">>, Props, false) of
     true ->
  case supervisor:terminate_child(couch_rep_sup, BaseId ++ Extension) of
         {error, not_found} ->
@@ -80,7 +80,7 @@ replicate({Props}=PostBody, UserCtx) ->
     false ->
         Server = start_replication_server(Replicator),
 
-        case proplists:get_value(<<"continuous">>, Props, false) of
+        case couch_util:get_value(<<"continuous">>, Props, false) of
         true ->
             {ok, {continuous, ?l2b(BaseId)}};
         false ->
@@ -111,12 +111,12 @@ init(InitArgs) ->
 do_init([RepId, {PostProps}, UserCtx] = InitArgs) ->
     process_flag(trap_exit, true),
 
-    SourceProps = proplists:get_value(<<"source">>, PostProps),
-    TargetProps = proplists:get_value(<<"target">>, PostProps),
+    SourceProps = couch_util:get_value(<<"source">>, PostProps),
+    TargetProps = couch_util:get_value(<<"target">>, PostProps),
 
-    DocIds = proplists:get_value(<<"doc_ids">>, PostProps, nil),
-    Continuous = proplists:get_value(<<"continuous">>, PostProps, false),
-    CreateTarget = proplists:get_value(<<"create_target">>, PostProps, false),
+    DocIds = couch_util:get_value(<<"doc_ids">>, PostProps, nil),
+    Continuous = couch_util:get_value(<<"continuous">>, PostProps, false),
+    CreateTarget = couch_util:get_value(<<"create_target">>, PostProps, false),
 
     Source = open_db(SourceProps, UserCtx),
     Target = open_db(TargetProps, UserCtx, CreateTarget),
@@ -190,8 +190,8 @@ do_init([RepId, {PostProps}, UserCtx] = 
         source_log = SourceLog,
         target_log = TargetLog,
         rep_starttime = httpd_util:rfc1123_date(),
-        src_starttime = proplists:get_value(instance_start_time, SourceInfo),
-        tgt_starttime = proplists:get_value(instance_start_time, TargetInfo),
+        src_starttime = couch_util:get_value(instance_start_time, SourceInfo),
+        tgt_starttime = couch_util:get_value(instance_start_time, TargetInfo),
         doc_ids = DocIds
     },
     {ok, State}.
@@ -302,17 +302,17 @@ start_replication_server(Replicator) ->
 compare_replication_logs(SrcDoc, TgtDoc) ->
     #doc{body={RepRecProps}} = SrcDoc,
     #doc{body={RepRecPropsTgt}} = TgtDoc,
-    case proplists:get_value(<<"session_id">>, RepRecProps) ==
-            proplists:get_value(<<"session_id">>, RepRecPropsTgt) of
+    case couch_util:get_value(<<"session_id">>, RepRecProps) ==
+            couch_util:get_value(<<"session_id">>, RepRecPropsTgt) of
     true ->
         % if the records have the same session id,
         % then we have a valid replication history
-        OldSeqNum = proplists:get_value(<<"source_last_seq">>, RepRecProps, 0),
-        OldHistory = proplists:get_value(<<"history">>, RepRecProps, []),
+        OldSeqNum = couch_util:get_value(<<"source_last_seq">>, RepRecProps, 0),
+        OldHistory = couch_util:get_value(<<"history">>, RepRecProps, []),
         {OldSeqNum, OldHistory};
     false ->
-        SourceHistory = proplists:get_value(<<"history">>, RepRecProps, []),
-        TargetHistory = proplists:get_value(<<"history">>, RepRecPropsTgt, []),
+        SourceHistory = couch_util:get_value(<<"history">>, RepRecProps, []),
+        TargetHistory = couch_util:get_value(<<"history">>, RepRecPropsTgt, []),
         ?LOG_INFO("Replication records differ. "
                 "Scanning histories to find a common ancestor.", []),
         ?LOG_DEBUG("Record on source:~p~nRecord on target:~p~n",
@@ -324,18 +324,18 @@ compare_rep_history(S, T) when S =:= [] 
     ?LOG_INFO("no common ancestry -- performing full replication", []),
     {0, []};
 compare_rep_history([{S}|SourceRest], [{T}|TargetRest]=Target) ->
-    SourceId = proplists:get_value(<<"session_id">>, S),
+    SourceId = couch_util:get_value(<<"session_id">>, S),
     case has_session_id(SourceId, Target) of
     true ->
-        RecordSeqNum = proplists:get_value(<<"recorded_seq">>, S, 0),
+        RecordSeqNum = couch_util:get_value(<<"recorded_seq">>, S, 0),
         ?LOG_INFO("found a common replication record with source_seq ~p",
             [RecordSeqNum]),
         {RecordSeqNum, SourceRest};
     false ->
-        TargetId = proplists:get_value(<<"session_id">>, T),
+        TargetId = couch_util:get_value(<<"session_id">>, T),
         case has_session_id(TargetId, SourceRest) of
         true ->
-            RecordSeqNum = proplists:get_value(<<"recorded_seq">>, T, 0),
+            RecordSeqNum = couch_util:get_value(<<"recorded_seq">>, T, 0),
             ?LOG_INFO("found a common replication record with source_seq ~p",
                 [RecordSeqNum]),
             {RecordSeqNum, TargetRest};
@@ -427,7 +427,7 @@ terminate_cleanup(#state{source=Source, 
 has_session_id(_SessionId, []) ->
     false;
 has_session_id(SessionId, [{Props} | Rest]) ->
-    case proplists:get_value(<<"session_id">>, Props, nil) of
+    case couch_util:get_value(<<"session_id">>, Props, nil) of
     SessionId ->
         true;
     _Else ->
@@ -437,7 +437,7 @@ has_session_id(SessionId, [{Props} | Res
 maybe_append_options(Options, Props) ->
     lists:foldl(fun(Option, Acc) ->
         Acc ++ 
-        case proplists:get_value(Option, Props, false) of
+        case couch_util:get_value(Option, Props, false) of
         true ->
             "+" ++ ?b2l(Option);
         false ->
@@ -449,19 +449,19 @@ make_replication_id({Props}, UserCtx) ->
     %% funky algorithm to preserve backwards compatibility
     {ok, HostName} = inet:gethostname(),
     % Port = mochiweb_socket_server:get(couch_httpd, port),
-    Src = get_rep_endpoint(UserCtx, proplists:get_value(<<"source">>, Props)),
-    Tgt = get_rep_endpoint(UserCtx, proplists:get_value(<<"target">>, Props)),    
+    Src = get_rep_endpoint(UserCtx, couch_util:get_value(<<"source">>, Props)),
+    Tgt = get_rep_endpoint(UserCtx, couch_util:get_value(<<"target">>, Props)),    
     Base = [HostName, Src, Tgt] ++
-        case proplists:get_value(<<"filter">>, Props) of
+        case couch_util:get_value(<<"filter">>, Props) of
         undefined ->
-            case proplists:get_value(<<"doc_ids">>, Props) of
+            case couch_util:get_value(<<"doc_ids">>, Props) of
             undefined ->
                 [];
             DocIds ->
                 [DocIds]
             end;
         Filter ->
-            [Filter, proplists:get_value(<<"query_params">>, Props, {[]})]
+            [Filter, couch_util:get_value(<<"query_params">>, Props, {[]})]
         end,
     Extension = maybe_append_options(
         [<<"continuous">>, <<"create_target">>], Props),
@@ -471,10 +471,10 @@ maybe_add_trailing_slash(Url) ->
     re:replace(Url, "[^/]$", "&/", [{return, list}]).
 
 get_rep_endpoint(_UserCtx, {Props}) ->
-    Url = maybe_add_trailing_slash(proplists:get_value(<<"url">>, Props)),
-    {BinHeaders} = proplists:get_value(<<"headers">>, Props, {[]}),
-    {Auth} = proplists:get_value(<<"auth">>, Props, {[]}),
-    case proplists:get_value(<<"oauth">>, Auth) of
+    Url = maybe_add_trailing_slash(couch_util:get_value(<<"url">>, Props)),
+    {BinHeaders} = couch_util:get_value(<<"headers">>, Props, {[]}),
+    {Auth} = couch_util:get_value(<<"auth">>, Props, {[]}),
+    case couch_util:get_value(<<"oauth">>, Auth) of
     undefined ->
         {remote, Url, [{?b2l(K),?b2l(V)} || {K,V} <- BinHeaders]};
     {OAuth} ->
@@ -513,9 +513,9 @@ open_db(Props, UserCtx) ->
     open_db(Props, UserCtx, false).
 
 open_db({Props}, _UserCtx, CreateTarget) ->
-    Url = maybe_add_trailing_slash(proplists:get_value(<<"url">>, Props)),
-    {AuthProps} = proplists:get_value(<<"auth">>, Props, {[]}),
-    {BinHeaders} = proplists:get_value(<<"headers">>, Props, {[]}),
+    Url = maybe_add_trailing_slash(couch_util:get_value(<<"url">>, Props)),
+    {AuthProps} = couch_util:get_value(<<"auth">>, Props, {[]}),
+    {BinHeaders} = couch_util:get_value(<<"headers">>, Props, {[]}),
     Headers = [{?b2l(K),?b2l(V)} || {K,V} <- BinHeaders],
     DefaultHeaders = (#http_db{})#http_db.headers,
     Db = #http_db{
@@ -653,8 +653,8 @@ ensure_full_commit(#http_db{} = Target) 
         method = post
     },
     {ResultProps} = couch_rep_httpc:request(Req),
-    true = proplists:get_value(<<"ok">>, ResultProps),
-    proplists:get_value(<<"instance_start_time">>, ResultProps);
+    true = couch_util:get_value(<<"ok">>, ResultProps),
+    couch_util:get_value(<<"instance_start_time">>, ResultProps);
 ensure_full_commit(Target) ->
     {ok, NewDb} = couch_db:open_int(Target#db.name, []),
     UpdateSeq = couch_db:get_update_seq(Target),
@@ -678,9 +678,9 @@ ensure_full_commit(#http_db{} = Source, 
         qs = [{seq, RequiredSeq}]
     },
     {ResultProps} = couch_rep_httpc:request(Req),
-    case proplists:get_value(<<"ok">>, ResultProps) of
+    case couch_util:get_value(<<"ok">>, ResultProps) of
     true ->
-        proplists:get_value(<<"instance_start_time">>, ResultProps);
+        couch_util:get_value(<<"instance_start_time">>, ResultProps);
     undefined -> nil end;
 ensure_full_commit(Source, RequiredSeq) ->
     {ok, NewDb} = couch_db:open_int(Source#db.name, []),
@@ -705,7 +705,7 @@ update_local_doc(#http_db{} = Db, #doc{i
         headers = [{"x-couch-full-commit", "false"} | Db#http_db.headers]
     },
     {ResponseMembers} = couch_rep_httpc:request(Req),
-    Rev = proplists:get_value(<<"rev">>, ResponseMembers),
+    Rev = couch_util:get_value(<<"rev">>, ResponseMembers),
     couch_doc:parse_rev(Rev);
 update_local_doc(Db, Doc) ->
     {ok, Result} = couch_db:update_doc(Db, Doc, [delay_commit]),

Modified: couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Tue May  4 02:01:00 2010
@@ -47,7 +47,7 @@ stop(Server) ->
 
 init([_Parent, #http_db{}=Source, Since, PostProps] = Args) ->
     process_flag(trap_exit, true),
-    Feed = case proplists:get_value(<<"continuous">>, PostProps, false) of
+    Feed = case couch_util:get_value(<<"continuous">>, PostProps, false) of
     false ->
         normal;
     true ->
@@ -59,11 +59,11 @@ init([_Parent, #http_db{}=Source, Since,
         {"since", Since},
         {"feed", Feed}
     ],
-    QS = case proplists:get_value(<<"filter">>, PostProps) of
+    QS = case couch_util:get_value(<<"filter">>, PostProps) of
     undefined ->
         BaseQS;
     FilterName ->
-        {Params} = proplists:get_value(<<"query_params">>, PostProps, {[]}),
+        {Params} = couch_util:get_value(<<"query_params">>, PostProps, {[]}),
         lists:foldr(
             fun({K, V}, QSAcc) ->
                 Ks = couch_util:to_list(K),
@@ -120,8 +120,8 @@ init([_Parent, Source, Since, PostProps]
     ChangesArgs = #changes_args{
         style = all_docs,
         since = Since,
-        filter = ?b2l(proplists:get_value(<<"filter">>, PostProps, <<>>)),
-        feed = case proplists:get_value(<<"continuous">>, PostProps, false) of
+        filter = ?b2l(couch_util:get_value(<<"filter">>, PostProps, <<>>)),
+        feed = case couch_util:get_value(<<"continuous">>, PostProps, false) of
             true ->
                 "continuous";
             false ->
@@ -144,11 +144,11 @@ init([_Parent, Source, Since, PostProps]
     {ok, #state{changes_loop=ChangesPid, init_args=InitArgs}}.
 
 filter_json_req(Db, PostProps) ->
-    case proplists:get_value(<<"filter">>, PostProps) of
+    case couch_util:get_value(<<"filter">>, PostProps) of
     undefined ->
         {[]};
     FilterName ->
-        {Query} = proplists:get_value(<<"query_params">>, PostProps, {[]}),
+        {Query} = couch_util:get_value(<<"query_params">>, PostProps, {[]}),
         {ok, Info} = couch_db:get_db_info(Db),
         % simulate a request to db_name/_changes
         {[
@@ -291,7 +291,7 @@ handle_messages([Chunk|Rest], State) ->
         #state{reply_to=nil} ->
             State#state{
                 count = Count+1,
-                last_seq = proplists:get_value(<<"seq">>, Props),
+                last_seq = couch_util:get_value(<<"seq">>, Props),
                 partial_chunk = <<>>,
                 rows=queue:in(Row,Rows)
             };
@@ -338,16 +338,16 @@ by_seq_loop(Server, Source, StartSeq) ->
         qs = [{limit, 1000}, {startkey, StartSeq}]
     },
     {Results} = couch_rep_httpc:request(Req),
-    Rows = proplists:get_value(<<"rows">>, Results),
+    Rows = couch_util:get_value(<<"rows">>, Results),
     if Rows =:= [] -> exit(normal); true -> ok end,
     EndSeq = lists:foldl(fun({RowInfoList}, _) ->
-        Id = proplists:get_value(<<"id">>, RowInfoList),
-        Seq = proplists:get_value(<<"key">>, RowInfoList),
-        {RowProps} = proplists:get_value(<<"value">>, RowInfoList),
+        Id = couch_util:get_value(<<"id">>, RowInfoList),
+        Seq = couch_util:get_value(<<"key">>, RowInfoList),
+        {RowProps} = couch_util:get_value(<<"value">>, RowInfoList),
         RawRevs = [
-            proplists:get_value(<<"rev">>, RowProps),
-            proplists:get_value(<<"conflicts">>, RowProps, []),
-            proplists:get_value(<<"deleted_conflicts">>, RowProps, [])
+            couch_util:get_value(<<"rev">>, RowProps),
+            couch_util:get_value(<<"conflicts">>, RowProps, []),
+            couch_util:get_value(<<"deleted_conflicts">>, RowProps, [])
         ],
         ParsedRevs = couch_doc:parse_revs(lists:flatten(RawRevs)),
         Change = {[

Modified: couchdb/trunk/src/couchdb/couch_rep_httpc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_httpc.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_httpc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_httpc.erl Tue May  4 02:01:00 2010
@@ -34,7 +34,7 @@ do_request(Req) ->
         qs = QS
     } = Req,
     Url = full_url(Req),
-    Headers = case proplists:get_value(<<"oauth">>, Auth) of
+    Headers = case couch_util:get_value(<<"oauth">>, Auth) of
     undefined ->
         Headers0;
     {OAuthProps} ->
@@ -75,7 +75,7 @@ db_exists(Req, CanonicalUrl, CreateDB) -
         url = Url
     } = Req,
     HeadersFun = fun(Method) ->
-        case proplists:get_value(<<"oauth">>, Auth) of
+        case couch_util:get_value(<<"oauth">>, Auth) of
         undefined ->
             Headers0;
         {OAuthProps} ->
@@ -178,7 +178,7 @@ process_response({error, Reason}, Req) -
 redirected_request(Req, RedirectUrl) ->
     {Base, QStr, _} = mochiweb_util:urlsplit_path(RedirectUrl),
     QS = mochiweb_util:parse_qs(QStr),
-    Hdrs = case proplists:get_value(<<"oauth">>, Req#http_db.auth) of
+    Hdrs = case couch_util:get_value(<<"oauth">>, Req#http_db.auth) of
     undefined ->
         Req#http_db.headers;
     _Else ->
@@ -209,11 +209,11 @@ oauth_header(Url, QS, Action, Props) ->
     % erlang-oauth doesn't like iolists
     QSL = [{couch_util:to_list(K), ?b2l(?l2b(couch_util:to_list(V)))} ||
         {K,V} <- QS],
-    ConsumerKey = ?b2l(proplists:get_value(<<"consumer_key">>, Props)),
-    Token = ?b2l(proplists:get_value(<<"token">>, Props)),
-    TokenSecret = ?b2l(proplists:get_value(<<"token_secret">>, Props)),
-    ConsumerSecret = ?b2l(proplists:get_value(<<"consumer_secret">>, Props)),
-    SignatureMethodStr = ?b2l(proplists:get_value(<<"signature_method">>, Props, <<"HMAC-SHA1">>)),
+    ConsumerKey = ?b2l(couch_util:get_value(<<"consumer_key">>, Props)),
+    Token = ?b2l(couch_util:get_value(<<"token">>, Props)),
+    TokenSecret = ?b2l(couch_util:get_value(<<"token_secret">>, Props)),
+    ConsumerSecret = ?b2l(couch_util:get_value(<<"consumer_secret">>, Props)),
+    SignatureMethodStr = ?b2l(couch_util:get_value(<<"signature_method">>, Props, <<"HMAC-SHA1">>)),
     SignatureMethodAtom = case SignatureMethodStr of
         "PLAINTEXT" ->
             plaintext;

Modified: couchdb/trunk/src/couchdb/couch_rep_missing_revs.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_missing_revs.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_missing_revs.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_missing_revs.erl Tue May  4 02:01:00 2010
@@ -145,44 +145,44 @@ changes_loop(OurServer, SourceChangesSer
 
 get_missing_revs(#http_db{}=Target, Changes) ->
     Transform = fun({Props}) ->
-        C = proplists:get_value(<<"changes">>, Props),
-        Id = proplists:get_value(<<"id">>, Props),
+        C = couch_util:get_value(<<"changes">>, Props),
+        Id = couch_util:get_value(<<"id">>, Props),
         {Id, [R || {[{<<"rev">>, R}]} <- C]}
     end,
     IdRevsList = [Transform(Change) || Change <- Changes],
     SeqDict = changes_dictionary(Changes),
     {LastProps} = lists:last(Changes),
-    HighSeq = proplists:get_value(<<"seq">>, LastProps),
+    HighSeq = couch_util:get_value(<<"seq">>, LastProps),
     Request = Target#http_db{
         resource = "_missing_revs",
         method = post,
         body = {IdRevsList}
     },
     {Resp} = couch_rep_httpc:request(Request),
-    case proplists:get_value(<<"missing_revs">>, Resp) of
+    case couch_util:get_value(<<"missing_revs">>, Resp) of
     {MissingRevs} ->
         X = [{Id, dict:fetch(Id, SeqDict), couch_doc:parse_revs(RevStrs)} ||
             {Id,RevStrs} <- MissingRevs],
         {HighSeq, X};
     _ ->
-        exit({target_error, proplists:get_value(<<"error">>, Resp)})
+        exit({target_error, couch_util:get_value(<<"error">>, Resp)})
     end;
 
 get_missing_revs(Target, Changes) ->
     Transform = fun({Props}) ->
-        C = proplists:get_value(<<"changes">>, Props),
-        Id = proplists:get_value(<<"id">>, Props),
+        C = couch_util:get_value(<<"changes">>, Props),
+        Id = couch_util:get_value(<<"id">>, Props),
         {Id, [couch_doc:parse_rev(R) || {[{<<"rev">>, R}]} <- C]}
     end,
     IdRevsList = [Transform(Change) || Change <- Changes],
     SeqDict = changes_dictionary(Changes),
     {LastProps} = lists:last(Changes),
-    HighSeq = proplists:get_value(<<"seq">>, LastProps),
+    HighSeq = couch_util:get_value(<<"seq">>, LastProps),
     {ok, Results} = couch_db:get_missing_revs(Target, IdRevsList),
     {HighSeq, [{Id, dict:fetch(Id, SeqDict), Revs} || {Id, Revs, _} <- Results]}.
 
 changes_dictionary(ChangeList) ->
-    KVs = [{proplists:get_value(<<"id">>,C), proplists:get_value(<<"seq">>,C)}
+    KVs = [{couch_util:get_value(<<"id">>,C), couch_util:get_value(<<"seq">>,C)}
         || {C} <- ChangeList],
     dict:from_list(KVs).
 

Modified: couchdb/trunk/src/couchdb/couch_rep_writer.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_writer.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_writer.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_writer.erl Tue May  4 02:01:00 2010
@@ -80,7 +80,7 @@ write_bulk_docs(#http_db{headers = Heade
     },
     ErrorsJson = case couch_rep_httpc:request(Request) of
     {FailProps} ->
-        exit({target_error, proplists:get_value(<<"error">>, FailProps)});
+        exit({target_error, couch_util:get_value(<<"error">>, FailProps)});
     List when is_list(List) ->
         List
     end,
@@ -141,8 +141,8 @@ write_multi_part_doc(#http_db{headers=He
     end.
 
 write_docs_1({Props}) ->
-    Id = proplists:get_value(<<"id">>, Props),
-    Rev = couch_doc:parse_rev(proplists:get_value(<<"rev">>, Props)),
-    ErrId = couch_util:to_existing_atom(proplists:get_value(<<"error">>, Props)),
-    Reason = proplists:get_value(<<"reason">>, Props),
+    Id = couch_util:get_value(<<"id">>, Props),
+    Rev = couch_doc:parse_rev(couch_util:get_value(<<"rev">>, Props)),
+    ErrId = couch_util:to_existing_atom(couch_util:get_value(<<"error">>, Props)),
+    Reason = couch_util:get_value(<<"reason">>, Props),
     {{Id, Rev}, {ErrId, Reason}}.

Modified: couchdb/trunk/src/couchdb/couch_server.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_server.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_server.erl (original)
+++ couchdb/trunk/src/couchdb/couch_server.erl Tue May  4 02:01:00 2010
@@ -53,7 +53,7 @@ sup_start_link() ->
 open(DbName, Options) ->
     case gen_server:call(couch_server, {open, DbName, Options}, infinity) of
     {ok, Db} ->
-        Ctx = proplists:get_value(user_ctx, Options, #user_ctx{}),
+        Ctx = couch_util:get_value(user_ctx, Options, #user_ctx{}),
         {ok, Db#db{user_ctx=Ctx}};
     Error ->
         Error
@@ -62,7 +62,7 @@ open(DbName, Options) ->
 create(DbName, Options) ->
     case gen_server:call(couch_server, {create, DbName, Options}, infinity) of
     {ok, Db} ->
-        Ctx = proplists:get_value(user_ctx, Options, #user_ctx{}),
+        Ctx = couch_util:get_value(user_ctx, Options, #user_ctx{}),
         {ok, Db#db{user_ctx=Ctx}};
     Error ->
         Error

Modified: couchdb/trunk/src/couchdb/couch_stream.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_stream.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_stream.erl (original)
+++ couchdb/trunk/src/couchdb/couch_stream.erl Tue May  4 02:01:00 2010
@@ -135,7 +135,7 @@ foldl_decode(DecFun, Fd, [Pos|Rest], Md5
     foldl_decode(DecFun, Fd, Rest, Md5, Md5Acc2, Fun, Fun(Bin, Acc)).
 
 gzip_init(Options) ->
-    case proplists:get_value(compression_level, Options, 0) of
+    case couch_util:get_value(compression_level, Options, 0) of
     Lvl when Lvl >= 1 andalso Lvl =< 9 ->
         Z = zlib:open(),
         % 15 = ?MAX_WBITS (defined in the zlib module)

Modified: couchdb/trunk/src/couchdb/couch_util.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_util.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_util.erl (original)
+++ couchdb/trunk/src/couchdb/couch_util.erl Tue May  4 02:01:00 2010
@@ -23,6 +23,7 @@
 -export([json_encode/1, json_decode/1]).
 -export([verify/2,simple_call/2,shutdown_sync/1]).
 -export([compressible_att_type/1]).
+-export([get_value/2, get_value/3]).
 
 -include("couch_db.hrl").
 -include_lib("kernel/include/file.hrl").
@@ -119,9 +120,19 @@ parse_term(List) ->
     {ok, Tokens, _} = erl_scan:string(List ++ "."),
     erl_parse:parse_term(Tokens).
 
+get_value(Key, List) ->
+    get_value(Key, List, undefined).
+
+get_value(Key, List, Default) ->
+    case lists:keysearch(Key, 1, List) of
+    {value, {Key,Value}} ->
+        Value;
+    false ->
+        Default
+    end.
 
 get_nested_json_value({Props}, [Key|Keys]) ->
-    case proplists:get_value(Key, Props, nil) of
+    case couch_util:get_value(Key, Props, nil) of
     nil -> throw({not_found, <<"missing json key: ", Key/binary>>});
     Value -> get_nested_json_value(Value, Keys)
     end;

Modified: couchdb/trunk/src/couchdb/couch_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view.erl Tue May  4 02:01:00 2010
@@ -80,7 +80,7 @@ cleanup_index_files(Db) ->
     % make unique list of group sigs
     Sigs = lists:map(fun(#doc{id = GroupId}) ->
         {ok, Info} = get_group_info(Db, GroupId),
-        ?b2l(proplists:get_value(signature, Info))
+        ?b2l(couch_util:get_value(signature, Info))
     end, [DD||DD <- DesignDocs, DD#doc.deleted == false]),
 
     FileList = list_index_files(Db),

Modified: couchdb/trunk/src/couchdb/couch_view_group.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_group.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view_group.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view_group.erl Tue May  4 02:01:00 2010
@@ -502,16 +502,16 @@ get_group_info(State) ->
 
 % maybe move to another module
 design_doc_to_view_group(#doc{id=Id,body={Fields}}) ->
-    Language = proplists:get_value(<<"language">>, Fields, <<"javascript">>),
-    {DesignOptions} = proplists:get_value(<<"options">>, Fields, {[]}),
-    {RawViews} = proplists:get_value(<<"views">>, Fields, {[]}),
+    Language = couch_util:get_value(<<"language">>, Fields, <<"javascript">>),
+    {DesignOptions} = couch_util:get_value(<<"options">>, Fields, {[]}),
+    {RawViews} = couch_util:get_value(<<"views">>, Fields, {[]}),
     % add the views to a dictionary object, with the map source as the key
     DictBySrc =
     lists:foldl(
         fun({Name, {MRFuns}}, DictBySrcAcc) ->
-            MapSrc = proplists:get_value(<<"map">>, MRFuns),
-            RedSrc = proplists:get_value(<<"reduce">>, MRFuns, null),
-            {ViewOptions} = proplists:get_value(<<"options">>, MRFuns, {[]}),
+            MapSrc = couch_util:get_value(<<"map">>, MRFuns),
+            RedSrc = couch_util:get_value(<<"reduce">>, MRFuns, null),
+            {ViewOptions} = couch_util:get_value(<<"options">>, MRFuns, {[]}),
             View =
             case dict:find({MapSrc, ViewOptions}, DictBySrcAcc) of
                 {ok, View0} -> View0;
@@ -574,7 +574,7 @@ init_group(Db, Fd, #group{def_lang=Lang,
                     {Count, Reduced}
                 end,
             
-            case proplists:get_value(<<"collation">>, Options, <<"default">>) of
+            case couch_util:get_value(<<"collation">>, Options, <<"default">>) of
             <<"default">> ->
                 Less = fun couch_view:less_json_ids/2;
             <<"raw">> ->

Modified: couchdb/trunk/src/couchdb/couch_view_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_updater.erl?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view_updater.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view_updater.erl Tue May  4 02:01:00 2010
@@ -49,9 +49,9 @@ update(Owner, Group) ->
     % update status every half second
     couch_task_status:set_update_frequency(500),
     #group{ design_options = DesignOptions } = Group,
-    IncludeDesign = proplists:get_value(<<"include_design">>,
+    IncludeDesign = couch_util:get_value(<<"include_design">>,
         DesignOptions, false),
-    LocalSeq = proplists:get_value(<<"local_seq">>, DesignOptions, false),
+    LocalSeq = couch_util:get_value(<<"local_seq">>, DesignOptions, false),
     DocOpts =
     case LocalSeq of
     true -> [conflicts, deleted_conflicts, local_seq];

Modified: couchdb/trunk/test/etap/090-task-status.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/090-task-status.t?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/etap/090-task-status.t (original)
+++ couchdb/trunk/test/etap/090-task-status.t Tue May  4 02:01:00 2010
@@ -29,7 +29,7 @@ check_status(Pid,ListPropLists) ->
     From = list_to_binary(pid_to_list(Pid)),
     Element = lists:foldl(
         fun(PropList,Acc) ->
-            case proplists:get_value(pid,PropList) of
+            case couch_util:get_value(pid,PropList) of
                 From ->
                     [PropList | Acc];
                 _ ->
@@ -38,7 +38,7 @@ check_status(Pid,ListPropLists) ->
         end,
         [], ListPropLists
     ),
-    proplists:get_value(status,hd(Element)).
+    couch_util:get_value(status,hd(Element)).
 
 loop() ->
     receive

Modified: couchdb/trunk/test/etap/110-replication-httpc.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/110-replication-httpc.t?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/etap/110-replication-httpc.t (original)
+++ couchdb/trunk/test/etap/110-replication-httpc.t Tue May  4 02:01:00 2010
@@ -107,8 +107,8 @@ test_put() ->
         method = put
     },
     {Resp} = couch_rep_httpc:request(Req),
-    etap:ok(proplists:get_value(<<"ok">>, Resp), "ok:true on upload"),
-    etap:is(<<"test_put">>, proplists:get_value(<<"id">>, Resp), "id is correct").
+    etap:ok(couch_util:get_value(<<"ok">>, Resp), "ok:true on upload"),
+    etap:is(<<"test_put">>, couch_util:get_value(<<"id">>, Resp), "id is correct").
 
 test_qs() ->
     Req = #http_db{

Modified: couchdb/trunk/test/etap/111-replication-changes-feed.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/111-replication-changes-feed.t?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/etap/111-replication-changes-feed.t (original)
+++ couchdb/trunk/test/etap/111-replication-changes-feed.t Tue May  4 02:01:00 2010
@@ -153,8 +153,8 @@ test_deleted_conflicts(Type) ->
     {ExpectProps} = generate_conflict(),
 
     %% delete the conflict revision
-    Id = proplists:get_value(<<"id">>, ExpectProps),
-    [Win, {[{<<"rev">>, Lose}]}] = proplists:get_value(<<"changes">>, ExpectProps),
+    Id = couch_util:get_value(<<"id">>, ExpectProps),
+    [Win, {[{<<"rev">>, Lose}]}] = couch_util:get_value(<<"changes">>, ExpectProps),
     Doc = couch_doc:from_json_obj({[
         {<<"_id">>, Id},
         {<<"_rev">>, Lose},

Modified: couchdb/trunk/test/etap/121-stats-aggregates.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/121-stats-aggregates.t?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/etap/121-stats-aggregates.t (original)
+++ couchdb/trunk/test/etap/121-stats-aggregates.t Tue May  4 02:01:00 2010
@@ -46,13 +46,13 @@ test_all_empty() ->
 
     etap:is(length(Aggs), 2, "There are only two aggregate types in testing."),
     etap:is(
-        proplists:get_value(testing, Aggs),
+        couch_util:get_value(testing, Aggs),
         {[{stuff, make_agg(<<"yay description">>,
             null, null, null, null, null)}]},
         "{testing, stuff} is empty at start."
     ),
     etap:is(
-        proplists:get_value(number, Aggs),
+        couch_util:get_value(number, Aggs),
         {[{'11', make_agg(<<"randomosity">>,
             null, null, null, null, null)}]},
         "{number, '11'} is empty at start."

Modified: couchdb/trunk/test/etap/140-attachment-comp.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/140-attachment-comp.t?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/etap/140-attachment-comp.t (original)
+++ couchdb/trunk/test/etap/140-attachment-comp.t Tue May  4 02:01:00 2010
@@ -344,19 +344,19 @@ test_1st_text_att_stub() ->
         Json,
         [<<"_attachments">>, <<"readme.txt">>]
     ),
-    TextAttLength = proplists:get_value(<<"length">>, TextAttJson),
+    TextAttLength = couch_util:get_value(<<"length">>, TextAttJson),
     etap:is(
         TextAttLength,
         length(test_text_data()),
         "1st text attachment stub length matches the uncompressed length"
     ),
-    TextAttEncoding = proplists:get_value(<<"encoding">>, TextAttJson),
+    TextAttEncoding = couch_util:get_value(<<"encoding">>, TextAttJson),
     etap:is(
         TextAttEncoding,
         <<"gzip">>,
         "1st text attachment stub has the encoding field set to gzip"
     ),
-    TextAttEncLength = proplists:get_value(<<"encoded_length">>, TextAttJson),
+    TextAttEncLength = couch_util:get_value(<<"encoded_length">>, TextAttJson),
     etap:is(
         TextAttEncLength,
         iolist_size(zlib:gzip(test_text_data())),
@@ -404,19 +404,19 @@ test_1st_png_att_stub() ->
         Json,
         [<<"_attachments">>, <<"icon.png">>]
     ),
-    PngAttLength = proplists:get_value(<<"length">>, PngAttJson),
+    PngAttLength = couch_util:get_value(<<"length">>, PngAttJson),
     etap:is(
         PngAttLength,
         length(test_png_data()),
         "1st png attachment stub length matches the uncompressed length"
     ),
-    PngEncoding = proplists:get_value(<<"encoding">>, PngAttJson),
+    PngEncoding = couch_util:get_value(<<"encoding">>, PngAttJson),
     etap:is(
         PngEncoding,
         undefined,
         "1st png attachment stub doesn't have an encoding field"
     ),
-    PngEncLength = proplists:get_value(<<"encoded_length">>, PngAttJson),
+    PngEncLength = couch_util:get_value(<<"encoded_length">>, PngAttJson),
     etap:is(
         PngEncLength,
         undefined,
@@ -531,19 +531,19 @@ test_2nd_text_att_stub() ->
         Json,
         [<<"_attachments">>, <<"readme.txt">>]
     ),
-    TextAttLength = proplists:get_value(<<"length">>, TextAttJson),
+    TextAttLength = couch_util:get_value(<<"length">>, TextAttJson),
     etap:is(
         TextAttLength,
         length(test_text_data()),
         "2nd text attachment stub length matches the uncompressed length"
     ),
-    TextAttEncoding = proplists:get_value(<<"encoding">>, TextAttJson),
+    TextAttEncoding = couch_util:get_value(<<"encoding">>, TextAttJson),
     etap:is(
         TextAttEncoding,
         <<"gzip">>,
         "2nd text attachment stub has the encoding field set to gzip"
     ),
-    TextAttEncLength = proplists:get_value(<<"encoded_length">>, TextAttJson),
+    TextAttEncLength = couch_util:get_value(<<"encoded_length">>, TextAttJson),
     etap:is(
         TextAttEncLength,
         iolist_size(zlib:gzip(test_text_data())),
@@ -591,19 +591,19 @@ test_2nd_png_att_stub() ->
         Json,
         [<<"_attachments">>, <<"icon.png">>]
     ),
-    PngAttLength = proplists:get_value(<<"length">>, PngAttJson),
+    PngAttLength = couch_util:get_value(<<"length">>, PngAttJson),
     etap:is(
         PngAttLength,
         length(test_png_data()),
         "2nd png attachment stub length matches the uncompressed length"
     ),
-    PngEncoding = proplists:get_value(<<"encoding">>, PngAttJson),
+    PngEncoding = couch_util:get_value(<<"encoding">>, PngAttJson),
     etap:is(
         PngEncoding,
         undefined,
         "2nd png attachment stub doesn't have an encoding field"
     ),
-    PngEncLength = proplists:get_value(<<"encoded_length">>, PngAttJson),
+    PngEncLength = couch_util:get_value(<<"encoded_length">>, PngAttJson),
     etap:is(
         PngEncLength,
         undefined,
@@ -660,20 +660,20 @@ test_get_already_compressed_att_stub(Doc
         Json,
         [<<"_attachments">>, iolist_to_binary(AttName)]
     ),
-    AttLength = proplists:get_value(<<"length">>, AttJson),
+    AttLength = couch_util:get_value(<<"length">>, AttJson),
     etap:is(
         AttLength,
         iolist_size((zlib:gzip(test_text_data()))),
         "Already compressed attachment stub length matches the "
         "compressed length"
     ),
-    Encoding = proplists:get_value(<<"encoding">>, AttJson),
+    Encoding = couch_util:get_value(<<"encoding">>, AttJson),
     etap:is(
         Encoding,
         <<"gzip">>,
         "Already compressed attachment stub has the encoding field set to gzip"
     ),
-    EncLength = proplists:get_value(<<"encoded_length">>, AttJson),
+    EncLength = couch_util:get_value(<<"encoded_length">>, AttJson),
     etap:is(
         EncLength,
         AttLength,

Modified: couchdb/trunk/test/view_server/query_server_spec.rb
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/view_server/query_server_spec.rb?rev=940708&r1=940707&r2=940708&view=diff
==============================================================================
--- couchdb/trunk/test/view_server/query_server_spec.rb (original)
+++ couchdb/trunk/test/view_server/query_server_spec.rb Tue May  4 02:01:00 2010
@@ -139,7 +139,7 @@ functions = {
     "js" => %{function(doc){emit("foo",doc.a); emit("bar",doc.a)}},
     "erlang" => <<-ERLANG
       fun({Doc}) ->
-        A = proplists:get_value(<<"a">>, Doc, null),
+        A = couch_util:get_value(<<"a">>, Doc, null),
         Emit(<<"foo">>, A),
         Emit(<<"bar">>, A)
       end.
@@ -153,7 +153,7 @@ functions = {
       JS
     "erlang" => <<-ERLANG
         fun({Doc}) ->
-            A = proplists:get_value(<<"a">>, Doc, null),
+            A = couch_util:get_value(<<"a">>, Doc, null),
             Emit(<<"baz">>, A)
         end.
     ERLANG
@@ -175,7 +175,7 @@ functions = {
       JS
     "erlang" => <<-ERLANG
       fun({NewDoc}, _OldDoc, _UserCtx) ->
-        case proplists:get_value(<<"bad">>, NewDoc) of
+        case couch_util:get_value(<<"bad">>, NewDoc) of
             undefined -> 1;
             _ -> {[{forbidden, <<"bad doc">>}]}
         end
@@ -191,8 +191,8 @@ functions = {
     JS
     "erlang" => <<-ERLANG
       fun({Doc}, Req) ->
-            Title = proplists:get_value(<<"title">>, Doc),
-            Body = proplists:get_value(<<"body">>, Doc),
+            Title = couch_util:get_value(<<"title">>, Doc),
+            Body = couch_util:get_value(<<"body">>, Doc),
             Resp = <<Title/binary, " - ", Body/binary>>,
         {[{<<"body">>, Resp}]}
       end.
@@ -208,8 +208,8 @@ functions = {
      JS
     "erlang" => <<-ERLANG
   fun({Doc}, Req) ->
-        Title = proplists:get_value(<<"title">>, Doc),
-        Body = proplists:get_value(<<"body">>, Doc),
+        Title = couch_util:get_value(<<"title">>, Doc),
+        Body = couch_util:get_value(<<"body">>, Doc),
         Resp = <<Title/binary, " - ", Body/binary>>,
         {[
         {<<"code">>, 200},
@@ -256,9 +256,9 @@ functions = {
     "erlang" => <<-ERLANG,
         fun(Head, {Req}) ->
             Send(<<"first chunk">>),
-            Send(proplists:get_value(<<"q">>, Req)),
+            Send(couch_util:get_value(<<"q">>, Req)),
             Fun = fun({Row}, _) ->
-                Send(proplists:get_value(<<"key">>, Row)),
+                Send(couch_util:get_value(<<"key">>, Row)),
                 {ok, nil}
             end,
             {ok, _} = FoldRows(Fun, nil),
@@ -283,7 +283,7 @@ functions = {
         fun(Head, Req) ->
             Send(<<"bacon">>),
             Fun = fun({Row}, _) ->
-                Send(proplists:get_value(<<"key">>, Row)),
+                Send(couch_util:get_value(<<"key">>, Row)),
                 Send(<<"eggs">>),
                 {ok, nil}
             end,
@@ -307,9 +307,9 @@ functions = {
     "erlang" => <<-ERLANG,
         fun(Head, {Req}) ->
             Send(<<"first chunk">>),
-            Send(proplists:get_value(<<"q">>, Req)),
+            Send(couch_util:get_value(<<"q">>, Req)),
             Fun = fun({Row}, _) ->
-                Send(proplists:get_value(<<"key">>, Row)),
+                Send(couch_util:get_value(<<"key">>, Row)),
                 {ok, nil}
             end,
             FoldRows(Fun, nil),
@@ -335,13 +335,13 @@ functions = {
     "erlang" => <<-ERLANG,
         fun(Head, {Req}) ->
             Send(<<"first chunk">>),
-            Send(proplists:get_value(<<"q">>, Req)),
+            Send(couch_util:get_value(<<"q">>, Req)),
             Fun = fun
                 ({Row}, Count) when Count < 2 ->
-                    Send(proplists:get_value(<<"key">>, Row)),
+                    Send(couch_util:get_value(<<"key">>, Row)),
                     {ok, Count+1};
                 ({Row}, Count) when Count == 2 ->
-                    Send(proplists:get_value(<<"key">>, Row)),
+                    Send(couch_util:get_value(<<"key">>, Row)),
                     {stop, <<"early tail">>}
             end,
             {ok, Tail} = FoldRows(Fun, 0),
@@ -380,10 +380,10 @@ functions = {
             Send(<<"bacon">>),
             Fun = fun
                 ({Row}, Count) when Count < 2 ->
-                    Send(proplists:get_value(<<"key">>, Row)),
+                    Send(couch_util:get_value(<<"key">>, Row)),
                     {ok, Count+1};
                 ({Row}, Count) when Count == 2 ->
-                    Send(proplists:get_value(<<"key">>, Row)),
+                    Send(couch_util:get_value(<<"key">>, Row)),
                     {stop, <<"early">>}
             end,
             {ok, Tail} = FoldRows(Fun, 0),
@@ -408,9 +408,9 @@ functions = {
     "erlang" => <<-ERLANG,
         fun(Head, {Req}) ->
             Send(<<"first chunk">>),
-            Send(proplists:get_value(<<"q">>, Req)),
+            Send(couch_util:get_value(<<"q">>, Req)),
             Fun = fun({Row}, _) ->
-                Send(proplists:get_value(<<"key">>, Row)),
+                Send(couch_util:get_value(<<"key">>, Row)),
                 {ok, nil}
             end,
             FoldRows(Fun, nil),
@@ -428,7 +428,7 @@ functions = {
     JS
     "erlang" => <<-ERLANG,
         fun({Doc}, Req) ->
-            proplists:get_value(<<"good">>, Doc)
+            couch_util:get_value(<<"good">>, Doc)
         end.
     ERLANG
   },