one of the documented procedures in this installation of the ACS
page_validation   args
What it does:
This proc allows page arg, etc. validation. It accepts a bunch of code blocks. Each one is executed, and any error signalled is appended to the list of exceptions. Note that you can customize the complaint page to match the design of your site, by changing the proc called to do the complaining: it's [ad_parameter ComplainProc "" ad_return_complaint] The division of labor between ad_page_variables and page_validation is that ad_page_variables handles programming errors, and does simple defaulting, so that the rest of the Tcl code doesn't have to worry about testing [info exists ...] everywhere. page_validation checks for errors in user input. For virtually all such tests, there is no distinction between "unsupplied" and "null string input". Note that errors are signalled using the Tcl "error" function. This allows nesting of procs which do the validation tests. In addition, validation functions can return useful values, such as trimmed or otherwise munged versions of the input.
Defined in: /web/philip/packages/acs-core/utilities-procs.tcl

Source code:

    if { [info exists {%%exception_list}] } {
	error "Something's wrong"
    # have to put this in the caller's frame, so that sub_page_validation can see it
    # that's because the "uplevel" used to evaluate the code blocks hides this frame
    upvar {%%exception_list} {%%exception_list}
    set {%%exception_list} [list]
    foreach validation_block $args {
	if { [catch {uplevel $validation_block} errmsg] } {
	    lappend {%%exception_list} $errmsg
    set exception_list ${%%exception_list}
    unset {%%exception_list}
    set n_exceptions [llength $exception_list]
    if { $n_exceptions != 0 } {
	set complain_proc [ad_parameter ComplainProc "" ad_return_complaint]
	if { $n_exceptions == 1 } {
	    $complain_proc $n_exceptions [lindex $exception_list 0]
	} else {
	    $complain_proc $n_exceptions "<li>[join $exception_list "\n<li>"]\n"