xo::ConnectionContext instproc query_parameter (public)
<instance of xo::ConnectionContext> query_parameter __spec \ [ default ]
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/context-procs.tcl
Get query parameter with default and optional value constraints. In case the value check for the query parameter fails, and no further precautions are performed (::aa_test_noabort is set), the method raises an exception with "ad_return_complaint" and aborts the script.
- Parameters:
- __spec (required)
- has the formname or name:value_constraint
- default (optional)
- default value
- Returns:
- actual value of the query parameter
- Testcases:
- api__context, test_xo_cc, path_resolve
Source code: # # Try to split up provided "__spec" argument into name and # value constraint components. # set __name $__spec regexp {^([^:]+):(.*)$} $__spec . __name constraint if {[:exists_parameter $__name]} { set value [:get_parameter $__name] } else { set value [next $__name $default] } # # If we have a value-constraint, we check for empty values only in # cases, where multiplicity is specified. This means effectively # that the default multiplicity is "0..1". # if {[info exists constraint]} { set r [xo::validate_parameter_constraints $__name $constraint $value] if {$r ne $value} { ns_log notice "converting value checker: query parameter <$__spec> -> '$value' -> '$r'" set value $r } } return $valueXQL Not present: Generic, PostgreSQL, Oracle