Documentation on Existing Filters and notes on how to roll your own


existing filters defined in Filters.py


how to create a new filter

1. create a function, it should have at mininmum a syntax of

def FilterName (name,value,md):

(or use namespace for md if you prefer)

where name is the name of the variable, 
value is the value of the variable,
md is the current namespace that. this is your key
to get back into the REQUEST and to the rest of Zope.

i'd recommend defining a filter in the file UserFilters.py

2. register your function as a filter

filters are stored in a dictionary of the module Filters. the keys
are the filter names accessible from within dtml-contract and the
values are a tuple defining the function, priority, and group. 

to register a filter you could either add it to that list directly
or 

import Filters
Filters.filters['filtername']=(function, priority, filtergroup,filtergroup)

the priority is an integer value which tells dtml-contract the
order it should evaluate filters in the same group, higher values
are evaluated first. groups are used to classify filters that
perform the same kind of operation on a variable. if multiple
filters are assigned to a variable from the same group, only the 
highest priority one executes.

-- if that was clear as mud let me try again.

all filters have a integer priority associated with them. when a variable
has more than one filter associated with it they are evaluated low to high
priority. if a filter has more than one filter from the same group than
only the highest priority filter of that group is used.

-- (ummm.. actually i don't know if the exclusion for multiple filters
from the same group made it into this release...)
