Links
- Home
- Docs
- TemplateLookup
- Template
- Context
- Filtering
u
: URL escaping, provided by urllib.quote_plus(string.encode('utf-8'))
h
: HTML escaping, provided by markupsafe.escape(string) (new as of 0.3.4 - prior versions use cgi.escape(string, True))
x
: XML escaping
trim
: whitespace trimming, provided by string.strip()
entity
: produces HTML entity references for applicable strings, derived from htmlentitydefs
unicode
(str on Python 3): produces a Python unicode string (this function is applied by default).
decode.\<some encoding\>
: decode input into a Python unicode with the specified encoding
n
: disable all default filtering; only filters specified in the local expression tag will be applied.
- Advocacy
- Used by Python.org.
- Default template engine of Pylons.
Notes
def create_mako_lookup(self, **kargs):
directories=self.config_root.mako.directories
extra_directories = kargs.pop("extra_directories", None)
if extra_directories:
directories.extend(extra_directories)
lookup_args = dict(
strict_undefined=True,
directories=directories,
filesystem_checks=True,
input_encoding='utf-8',
output_encoding='utf-8',
encoding_errors='replace',
format_exceptions=True)
lookup_args.update(kargs)
import mako.lookup
return mako.lookup.TemplateLookup(**lookup_args)