def render_jinja2(template_name, extra_vars=None, cache_key=None,
                 cache_type=None, cache_expire=None):
    # Create a render callable for the cache function
    def render_template():
        # Pull in extra vars if needed
        globs = extra_vars or {}

        # Second, get the globals
        globs.update(pylons_globals())

        # Grab a template reference
        template = \
            globs['app_globals'].jinja2_env.get_template(template_name)

        return literal(template.render(**globs))

    return cached_template(template_name, render_template, cache_key=cache_key,
                           cache_type=cache_type, cache_expire=cache_expire)
Render a template with Jinja2
dataset/ETHPy150Open Pylons/pylons/pylons/templating.py/render_jinja2