xo::validate_parameter_constraints (public)
xo::validate_parameter_constraints name constraint value
Defined in packages/xotcl-core/tcl/context-procs.tcl
Validate the provided value against the constraints. In case of failure, return with ad_return_complaint when there is a connection, otherwise raise an error.
- Parameters:
- name (required)
- constraint (required)
- value (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # # 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". # #ns_log notice "::xo::validate_parameter_constraints $name $constraint input '$value'" if {[string first . $constraint] > -1 || $value ne ""} { try { # # Use parseargs with "-asdict" option when it is available, # since it does not globber the variable namespace. For legacy # applications, lets hope that no query parameter named # "__name" is used with a value constraint. # if {[::acs::icanuse "nsf::parseargs -asdict"]} { # # Newer versions will use this branch # set value [dict get [nsf::parseargs -asdict ${name}:$constraint [list $value]] $name] } else { # # This is the legacy branch. nsf::parseargs might clobber # "name", therefore, save it in an highly unlikely variable # name. # set { name } $name nsf::parseargs ${name}:$constraint [list $value] set value [set ${ name }] } } on error {errorMsg} { #ns_log notice ".... nsf::parseargs error '$errorMsg'" if {[ns_conn isconnected] && ![info exists ::aa_test_noabort]} { ad_return_complaint 1 [ns_quotehtml $errorMsg] ad_script_abort } else { throw $::errorInfo $errorMsg } } } #ns_log notice "::xo::validate_parameter_constraints $name $constraint -> '$value'" return $valueXQL Not present: Generic, PostgreSQL, Oracle