Permalink
Browse files

Add missing cookie_default function

  • Loading branch information...
1 parent 99179b8 commit 4cab73317c47828acd4a3850c6b67893a371bfe1 @choptastic choptastic committed Jun 14, 2011
Showing with 10 additions and 0 deletions.
  1. +7 −0 src/lib/wf_context.erl
  2. +3 −0 src/wf.erl
@@ -83,6 +83,12 @@ cookie(Cookie) ->
Req = request_bridge(),
Req:cookie(Cookie).
+cookie_default(Cookie,DefaultValue) ->
+ case cookie(Cookie) of
+ undefined -> DefaultValue;
+ Value -> Value
+ end.
+
cookie(Cookie, Value) ->
Res = response_bridge(),
response_bridge(Res:cookie(Cookie, Value)),
@@ -93,6 +99,7 @@ cookie(Cookie, Value, Path, MinutesToLive) ->
response_bridge(Res:cookie(Cookie, Value, Path, MinutesToLive)),
ok.
+
%%% TRANSIENT CONTEXT %%%
anchor(Anchor) ->
View
@@ -172,6 +172,9 @@ cookies() ->
cookie(Cookie) ->
wf_context:cookie(Cookie).
+cookie_default(Cookie,DefaultValue) ->
+ wf_context:cookie_default(Cookie,DefaultValue).
+
cookie(Cookie, Value) ->
ok = wf_context:cookie(Cookie, Value).

0 comments on commit 4cab733

Please sign in to comment.