访问系统环境变量的jinja2扩展
jinja2-shell-extension的Python项目详细描述
这是什么?在
这是执行system/shell的jinja2扩展 来自模板的命令。在
警告:请确保提交到此筛选器的任何字符串都有效 用它打开安全漏洞
语法
语法是'full_command_with_args'|shell([die_on_error_boolean_flag], [encoding])
。在
示例
fromjinja2importTemplate,Environment# We load the extension in a jinja2 Environmentenv=Environment(extensions=["jinja2_shell_extension.ShellExtension"])# For the example, we use a template from a simple stringtemplate=env.from_string("{{ 'date --rfc-2822'|shell() }}")result=template.render()# example: result == "Fri, 31 Jan 2020 13:35:56 +0100"# [...]
- 项目
标签: