class MalleableUndefined(Undefined):

    def __getitem__(self, key):
        return self

def __getattr__(self, key):
    return self


class CustomFlask(Flask):
    pass
How to make Jinja2 convert all UndefinedError exceptions to blank strings?