ad_page_contract_filter_rule (public)

 ad_page_contract_filter_rule name proc_args doc_string body

Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl

A filter rule determines what filters are applied to a given value. The code is passed the name of the formal argument and the list of filters currently being applied, and should on that basis modify the list of filters to suit its needs. Usually, a filter rule will add a certain filter, unless some list of filters are already present.

Unlike the filters themselves (registered with ad_page_contract_filter), all rules are always applied to all formal arguments of all pages.

Parameters:
name - filter rules must be named. The name isn't referred to anywhere.
proc_args - the filter rule proc must take two arguments, name and filters, although you can name them as you like. The first will be set to the name of the formal argument, the second will be upvar'd to the list of filters, so that any modifications you make to this list are reflected in the actual list of filters being applied.
doc_string - let other programmers know what your filter rule does.
body - the code to manipulate the filter list.
Author:
Lars Pind <lars@pinds.com>
Created:
25 July 2000

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_page_contract_filter_rule_script ad_page_contract_filter_rule_script (public) ad_page_contract_filter_rule ad_page_contract_filter_rule ad_page_contract_filter_rule->_ ad_page_contract_filter_rule->ad_page_contract_filter_rule_script

Testcases:
No testcase defined.
Source code:
    if { [llength $proc_args] != 2 } {
        return -code error [_ acs-tcl.lt_The_proc_must_accept_]
    }

    set script [info script]
    set proc_name ad_page_contract_filter_rule_proc_$name
    set rule_key ::acs::ad_page_contract_filter_rules($name)

    set mutex [nsv_get ad_page_contract_mutex filter_rules]
    ns_mutex lock $mutex

    if {[info exists $rule_key]} {
        set prior_script [set $rule_key]
    } elseif { [nsv_exists ad_page_contract_filter_rules $name] } {
        set prior_script [ad_page_contract_filter_rule_script $name]
    }

    if { [info exists prior_script] && $script ne $prior_script } {
        ns_log Warning "Multiple definitions of the ad_page_contract_filter_rule \"$name\" in $script and $prior_script"
    }

    set rule_info [list $proc_name $doc_string $script]
    nsv_set ad_page_contract_filter_rules $name $rule_info
    set $rule_key $rule_info
    ns_mutex unlock $mutex

    # same trick as ad_page_contract_filter does.

    lassign $proc_args arg0 arg1
    d_proc $proc_name [list $arg0 ${arg1}_varname] $doc_string "upvar \$${arg1}_varname $arg1\n$body"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: