Please help with User-Defined Filter... Where is it registered???

1 view
Skip to first unread message

Charlie Taylor

unread,
Feb 12, 2012, 4:24:29 AM2/12/12
to sphinx-dev
Custom Filters

Custom filters are just regular Python functions that take the left
side of the filter as first argument and the the arguments passed to
the filter as extra arguments or keyword arguments.

For example in the filter {{ 42|myfilter(23) }} the function would be
called with myfilter(42, 23).

You can register "myfilter" on the template environment by updating
the filters dict on the environment:

environment.filters['myfilter'] = myfilter

===> Does anyone have an example of the above?

===> Is "environment.filters" part of some builder object somewhere?
Reply all
Reply to author
Forward
0 new messages