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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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?