Commit e8618692387dc76379b129c0b3de63c3083f0277
1 parent
6f536647
add the get_mb_DB_id which get Maybe a DB_id from web_arg
Showing
1 changed file
with
21 additions
and
7 deletions
Show diff stats
web/CXM_web_arg_utils.anubis
| @@ -9,27 +9,41 @@ transmit tools/basis.anubis | @@ -9,27 +9,41 @@ transmit tools/basis.anubis | ||
| 9 | transmit calexium_lib/web/CXM_common.anubis | 9 | transmit calexium_lib/web/CXM_common.anubis |
| 10 | transmit calexium_lib/database/db_types.anubis | 10 | transmit calexium_lib/database/db_types.anubis |
| 11 | 11 | ||
| 12 | -public define DB_id | ||
| 13 | - get_DB_id | 12 | +public define Maybe(DB_id) |
| 13 | + get_mb_DB_id | ||
| 14 | ( | 14 | ( |
| 15 | List(Web_arg) lwa, | 15 | List(Web_arg) lwa, |
| 16 | String arg_name | 16 | String arg_name |
| 17 | ) = | 17 | ) = |
| 18 | if web_arg_value(lwa, arg_name) is | 18 | if web_arg_value(lwa, arg_name) is |
| 19 | { | 19 | { |
| 20 | - not_found then none, | 20 | + not_found then failure, |
| 21 | found(value) then | 21 | found(value) then |
| 22 | //Check if value is none which means no id provided | 22 | //Check if value is none which means no id provided |
| 23 | if value="none" then | 23 | if value="none" then |
| 24 | - none | 24 | + success(none) |
| 25 | else | 25 | else |
| 26 | //Now try to convert the string into Int to get the id | 26 | //Now try to convert the string into Int to get the id |
| 27 | if decimal_scan(value) is | 27 | if decimal_scan(value) is |
| 28 | { | 28 | { |
| 29 | - failure then none, | ||
| 30 | - success(_value) then db_id(_value) | 29 | + failure then success(none), |
| 30 | + success(_value) then success(db_id(_value)) | ||
| 31 | } | 31 | } |
| 32 | - }. | 32 | + } |
| 33 | +. | ||
| 34 | + | ||
| 35 | +public define DB_id | ||
| 36 | + get_DB_id | ||
| 37 | + ( | ||
| 38 | + List(Web_arg) lwa, | ||
| 39 | + String arg_name | ||
| 40 | + ) = | ||
| 41 | + if get_mb_DB_id(lwa, arg_name) is | ||
| 42 | + { | ||
| 43 | + failure then none, | ||
| 44 | + success(value) then value | ||
| 45 | + } | ||
| 46 | +. | ||
| 33 | 47 | ||
| 34 | public define Maybe(DB_date) | 48 | public define Maybe(DB_date) |
| 35 | get_DB_date | 49 | get_DB_date |