~ubuntu-branches/ubuntu/hardy/mako/hardy-backports

« back to all changes in this revision

Viewing changes to doc/build/content/filtering.txt

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-09-09 02:09:15 UTC
  • mfrom: (5.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080909020915-y0zgvojsponlnwx8
Tags: 0.2.2-1~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 
58
58
**New in version 0.1.2**
59
59
 
60
 
In addition to the `expression_filter` argument, the `default_filters` argument to both `Template` and `TemplateLookup` can specify filtering for all expression tags at the programmatic level.  This array-based argument defaults to `["unicode"]`:
 
60
In addition to the `expression_filter` argument, the `default_filters` argument to both `Template` and `TemplateLookup` can specify filtering for all expression tags at the programmatic level.  This array-based argument, when given its default argument of `None`, will be internally set to `["unicode"]`, except when `disable_unicode=True` is set in which case it defaults to `["str"]`:
61
61
 
62
62
    {python}
63
63
    t = TemplateLookup(directories=['/tmp'], default_filters=['unicode'])
66
66
 
67
67
    {python}
68
68
    t = TemplateLookup(directories=['/tmp'], default_filters=['decode.utf8'])
 
69
 
 
70
To disable `default_filters` entirely, set it to an empty list:
 
71
 
 
72
    {python}
 
73
    t = TemplateLookup(directories=['/tmp'], default_filters=[])
69
74
    
70
75
Any string name can be added to `default_filters` where it will be added to all expressions as a filter.  The filters are applied from left to right, meaning the leftmost filter is applied first.
71
76