def __init__(self, template, dirname=None, tolerant=False, **kwargs):
        """Initialize mako template."""
        super(MakoEngine, self).__init__(**kwargs)

        directories = [dirname] if dirname is not None else ['.']
        lookup = TemplateLookup(directories=directories)

        default_filters = ['filter_undefined'] if tolerant else None
        encoding_errors = 'replace' if tolerant else 'strict'
        imports = ['def filter_undefined(value):\n'
                   '    if value is UNDEFINED:\n'
                   '        return \'<UNDEFINED>\'\n'
                   '    return value\n']
        self.template = Template(template,
                                 default_filters=default_filters,
                                 encoding_errors=encoding_errors,
                                 imports=imports,
                                 lookup=lookup,
                                 strict_undefined=not tolerant,
                                 )
def __init__ ( self , template , dirname = None , tolerant = False , ** kwargs ) : super ( MakoEngine , self ) . __init__ ( ** kwargs ) directories = [ dirname ] if dirname is not None else [ '.' ] lookup = TemplateLookup ( directories = directories ) default_filters = [ 'filter_undefined' ] if tolerant else None encoding_errors = 'replace' if tolerant else 'strict' imports = [ 'def filter_undefined(value):\n' '    if value is UNDEFINED:\n' '        return \'<UNDEFINED>\'\n' '    return value\n' ] self . template = Template ( template , default_filters = default_filters , encoding_errors = encoding_errors , imports = imports , lookup = lookup , strict_undefined = not tolerant , )
Initialize mako template.