odoo中html类型字段中的sanitize属性有什么用?

问题描述 投票:0回答:2

在 html 类型的字段中,有一个属性可用,我们可以在其中传递 True/False

body_html = fields.Html('Body', translate=True, sanitize=False, help="Rich-text/HTML version of the message (placeholders may be used here)")

body_html = fields.Html('Body', translate=True, sanitize=True, help="Rich-text/HTML version of the message (placeholders may be used here)")

如果我们设置 True/False 那么我们会得到相同的结果。

如果我们在此字段中设置 True/False 有什么区别?

odoo odoo-10 language-translation
2个回答
4
投票

它只是告诉 Odoo 是否清理 html 代码,例如删除脚本、标签/节点等。有关更多信息,请查看代码


0
投票
  1. 允许的标签:Odoo 将允许一组预定义的 HTML 标签(如 、 、

    等)和属性(如链接的 href),同时删除潜在有害的标签(如 、 等)。

安全渲染:在表单或报表上显示内容时,经过净化的 HTML 将安全渲染,防止任何恶意脚本执行。

© www.soinside.com 2019 - 2024. All rights reserved.