diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-30 12:03:15 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-30 12:03:15 +0000 |
commit | 6ae13b5f8b827bc87a8cf3306c3caa1b97e49df3 (patch) | |
tree | 9662164348a314705094f5f52456ab7bfe330df9 /src/couchdb/couch_httpd_rewrite.erl | |
parent | 1c0a6e9c637fcfec2990c6318b3c69e4c7591d76 (diff) |
Removing ?getv macros.
With OTP releases up to R13B03 it's not possible to define a 2 macro functions with the same name and different arities.
(Only allowed in R13B04 and R14).
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003025 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_rewrite.erl')
-rw-r--r-- | src/couchdb/couch_httpd_rewrite.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl index 276e0601..36b90928 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 ?getv(<<"rewrites">>, Props) of + case couch_util:get_value(<<"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 ?getv(K1, QueryArgs1) of + KV = case couch_util:get_value(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), - ?getv(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 @@ -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 ?getv({bind, P}, Bindings) of + P2 = case couch_util:get_value({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 ?getv(<<"method">>, Rule) of + Method = case couch_util:get_value(<<"method">>, Rule) of undefined -> ?MATCH_ALL; M -> to_binding(M) end, - QueryArgs = case ?getv(<<"query">>, Rule) of + QueryArgs = case couch_util:get_value(<<"query">>, Rule) of undefined -> []; {Args} -> Args end, - FromParts = case ?getv(<<"from">>, Rule) of + FromParts = case couch_util:get_value(<<"from">>, Rule) of undefined -> [?MATCH_ALL]; From -> parse_path(From) end, - ToParts = case ?getv(<<"to">>, Rule) of + ToParts = case couch_util:get_value(<<"to">>, Rule) of undefined -> throw({error, invalid_rewrite_target}); To -> |