def yaml_filter(obj):
if isinstance(obj, str_types):
return obj
elif isinstance(obj, jinja2.Undefined):
return ''
else:
try:
return dump(obj)
except Exception as exc:
raise RuntimeError(
'Unable to serialize {!r} to YAML because {}.'
'Template render must produce valid YAML file, so please use'
' simple types in `with_items` block.'
''.format(obj, exc)
)
transformer.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录