From 6c6db011c2064597526c6f36878a282238dd2bf2 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Mon, 27 Sep 2010 19:14:37 +0000 Subject: Replacing calls to couch_util:get_value with ?getv git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001879 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_rewrite.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/couchdb/couch_httpd_rewrite.erl') diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl index 36b90928..276e0601 100644 --- a/src/couchdb/couch_httpd_rewrite.erl +++ b/src/couchdb/couch_httpd_rewrite.erl @@ -132,7 +132,7 @@ handle_rewrite_req(#httpd{ #doc{body={Props}} = DDoc, % get rules from ddoc - case couch_util:get_value(<<"rewrites">>, Props) of + case ?getv(<<"rewrites">>, Props) of undefined -> couch_httpd:send_error(Req, 404, <<"rewrite_error">>, <<"Invalid path.">>); @@ -215,7 +215,7 @@ try_bind_path([Dispatch|Rest], Method, PathParts, QueryList) -> % QueryArgs1 Bindings2 = lists:foldl(fun({K, V}, Acc) -> K1 = to_binding(K), - KV = case couch_util:get_value(K1, QueryArgs1) of + KV = case ?getv(K1, QueryArgs1) of undefined -> [{K1, V}]; _V1 -> [] end, @@ -288,7 +288,7 @@ replace_var(Key, Value, Bindings) -> get_var(VarName, Props, Default) -> VarName1 = to_binding(VarName), - couch_util:get_value(VarName1, Props, Default). + ?getv(VarName1, Props, Default). %% doc: build new patch from bindings. bindings are query args %% (+ dynamic query rewritten if needed) and bindings found in @@ -302,7 +302,7 @@ make_new_path([?MATCH_ALL|_Rest], _Bindings, Remaining, Acc) -> Acc1 = lists:reverse(Acc) ++ Remaining, Acc1; make_new_path([{bind, P}|Rest], Bindings, Remaining, Acc) -> - P2 = case couch_util:get_value({bind, P}, Bindings) of + P2 = case ?getv({bind, P}, Bindings) of undefined -> << "undefined">>; P1 -> P1 end, @@ -370,20 +370,20 @@ normalize_path1([Path|Rest], Acc) -> %% @doc transform json rule in erlang for pattern matching make_rule(Rule) -> - Method = case couch_util:get_value(<<"method">>, Rule) of + Method = case ?getv(<<"method">>, Rule) of undefined -> ?MATCH_ALL; M -> to_binding(M) end, - QueryArgs = case couch_util:get_value(<<"query">>, Rule) of + QueryArgs = case ?getv(<<"query">>, Rule) of undefined -> []; {Args} -> Args end, - FromParts = case couch_util:get_value(<<"from">>, Rule) of + FromParts = case ?getv(<<"from">>, Rule) of undefined -> [?MATCH_ALL]; From -> parse_path(From) end, - ToParts = case couch_util:get_value(<<"to">>, Rule) of + ToParts = case ?getv(<<"to">>, Rule) of undefined -> throw({error, invalid_rewrite_target}); To -> -- cgit v1.2.3