Commit 073cc6df64c927a7a40fc5a3182ddf7c5015b8ca
1 parent
605449b0
add get maybe bool from web argument
Showing
1 changed file
with
14 additions
and
2 deletions
Show diff stats
web/CXM_web_arg_utils.anubis
| @@ -129,6 +129,18 @@ public define Maybe(String) | @@ -129,6 +129,18 @@ public define Maybe(String) | ||
| 129 | } | 129 | } |
| 130 | . | 130 | . |
| 131 | 131 | ||
| 132 | +public define Maybe(Bool) | ||
| 133 | + get_mb_Bool | ||
| 134 | + ( | ||
| 135 | + List(Web_arg) lwa, | ||
| 136 | + String arg_name | ||
| 137 | + ) = | ||
| 138 | + if web_arg_value(lwa, arg_name) is | ||
| 139 | + { | ||
| 140 | + not_found then failure, | ||
| 141 | + found(value) then success(to_Bool(value)) | ||
| 142 | + }. | ||
| 143 | + | ||
| 132 | public define Bool | 144 | public define Bool |
| 133 | get_Bool | 145 | get_Bool |
| 134 | ( | 146 | ( |
| @@ -137,8 +149,8 @@ public define Bool | @@ -137,8 +149,8 @@ public define Bool | ||
| 137 | ) = | 149 | ) = |
| 138 | if web_arg_value(lwa, arg_name) is | 150 | if web_arg_value(lwa, arg_name) is |
| 139 | { | 151 | { |
| 140 | - not_found then false, | ||
| 141 | - found(_) then true | 152 | + not_found then false, |
| 153 | + found(value) then true | ||
| 142 | }. | 154 | }. |
| 143 | 155 | ||
| 144 | public define Bool | 156 | public define Bool |