【文件属性】:
文件名称:jinja2-pimport:用于Python导入的Jinja2扩展
文件大小:8KB
文件格式:ZIP
更新时间:2021-03-27 19:51:26
Python
Jinja2 PImport
Jinja2 Extension for Python导入关键字
因此,我们不必只为简单功能编写新的jinja2过滤器。
它暴露出了一种强大的武器,可以射杀您的脚,使用风险自负!
用法
执行“ echo hello” shell命令并获取输出
from jinja2 import Environment
env = Environment(extensions=['jinja2_pimport.PImportExtension'])
template = env.from_string("{{ ('subprocess'|pimport).check_output('echo hello', shell=True).strip().decode() }}")
template.render()
# => hello
执照
jinja2-pimport是根据
【文件预览】:
jinja2-pimport-master
----MANIFEST.in(193B)
----README.rst(913B)
----CONTRIBUTING.rst(158B)
----src()
--------__init__.py(197B)
--------pimportextension.py(332B)
----HISTORY.rst(32B)
----requirements.txt(5B)
----CONTRIBUTORS.rst(203B)
----.travis.yml(1KB)
----tox.ini(387B)
----LICENSE(1KB)
----requirements_dev.txt(179B)
----setup.cfg(306B)
----setup.py(2KB)
----Makefile(455B)
----tests()
--------test_jinja2_pimport.py(534B)
--------__init__.py(69B)
----.gitignore(726B)