def __init__(self, *args, **kwargs):
        """Construct the expression engine."""
        super().__init__(*args, **kwargs)

        # Initialize the Jinja2 environment.
        # TODO: Should we use a sandboxed environment?
        self._environment = Environment(self)
        # Register built-in filters.
        self._environment.filters.update(builtin_filters)
        # Register custom filters.
        self._register_custom_filters()
        # Override the safe filter.
        self._environment.filters['safe'] = self._filter_mark_safe

        # Decorate all filters with our wrapper.
        for name, function in self._environment.filters.items():
            self._environment.filters[name] = self._wrap_jinja_filter(function)

        # Escape function and safe wrapper.
        self._escape = None
        self._safe_wrapper = None
def __init__ ( self , * args , ** kwargs ) : super ( ) . __init__ ( * args , ** kwargs ) self . _environment = Environment ( self ) self . _environment . filters . update ( builtin_filters ) self . _register_custom_filters ( ) self . _environment . filters [ 'safe' ] = self . _filter_mark_safe for name , function in self . _environment . filters . items ( ) : self . _environment . filters [ name ] = self . _wrap_jinja_filter ( function ) self . _escape = None self . _safe_wrapper = None
Construct the expression engine.