Welcome to Photo.net: A Community of Photographers

ad_register_filter

one of the documented procedures in this installation of the ACS
Usage:
ad_register_filter { -debug f -priority 10000 -critical f } kind method path proc args
What it does:
Registers a filter (see ns_register_filter for syntax). Priority is an integer; lower numbers indicate higher priority. Use a method of "*" to register GET, POST, and HEAD filters. If a filter is not critical, page viewing will not abort if a filter fails. If debug is set to "t", all invocations of the filter will be ns_logged.
Defined in: /web/photonet/tcl/ad-utilities.tcl.preload

Source code:

arg_parser_for_ad_register_filter $args

    if { $method == "*" } {
	# Shortcut to allow registering filter for all methods.
	foreach method { GET POST HEAD } {
	    eval [concat [list ad_register_filter -debug $debug -priority $priority -critical $critical $kind $method $path $proc] $args]
	}
	return
    }

    ns_mutex lock [nsv_get ad_filters mutex]

    # Append the filter to our list.
    set filters [nsv_get ad_filters "$method,$kind"]
    set filter_info [list $priority $kind $method $path $proc $args $debug $critical]

    set counter 0
    # Insert the filter in sorted order (lowest priority# first).
    foreach f $filters {
	if { ![string compare $f $filter_info] } {
	    ns_log debug "$kind filter $proc already registered for $method $path"
	    ns_mutex unlock [nsv_get ad_filters mutex]
	    return
	}
	if { $priority < [lindex $f 0] } {
	    break
	}
	incr counter
    }
    ns_log debug "Registering $kind filter $proc for $method $path with priority $priority"
    set filters [linsert $filters $counter $filter_info]
    nsv_set ad_filters "$method,$kind" $filters

    ns_mutex unlock [nsv_get ad_filters mutex]


Photography