__init__.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:inmanta 作者: inmanta 项目源码 文件源码
def template(ctx: Context, path: "string"):
    """
        Execute the template in path in the current context. This function will
        generate a new statement that has dependencies on the used variables.
    """
    jinja_env = _get_template_engine(ctx)

    if path in tcache:
        template = tcache[path]
    else:
        template = jinja_env.get_template(path)
        tcache[path] = template

    resolver = ctx.get_resolver()

    try:
        out = template.render({"{{resolver": resolver})
        return out
    except UndefinedError as e:
        raise NotFoundException(ctx.owner, None, e.message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号