Logger在Plone的RestrictedPython脚本中可以正常工作

编程入门 行业动态 更新时间:2024-10-25 18:28:21
本文介绍了Logger在Plone的RestrictedPython脚本中可以正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在.cpy文件(python)中打印?我正在使用Zope/Plone,而我刚开始使用Python.我已经尝试过了

How to print in a .cpy file (python) ? I'm using Zope/Plone and I've just started with Python. I've tried this

import logging logger = logging.getLogger() logger.info("hello plone")

但这是行不通的.

谢谢您的回答

推荐答案

上面的答案意味着您不能在RestrictedPython脚本(可通过Web编辑的Plone脚本)中导入任何模块.这些脚本具有最终用户权限,因此不允许运行任意Python代码.

The answer above means that you cannot import any modules in RestrictedPython scripts which are through-the-web editable Plone scripts. These scripts have end-user permissions, so they are not allowed to run arbitrary Python code.

collective-docs.readthedocs/en/Latest/security/sandboxing.html

您可以在受限制的python脚本中使用context.plone_log("mystring")样式日志记录,以进行记录.

You can use context.plone_log("mystring") style logging in restricted python scripts for logging purposes.

更多推荐

Logger在Plone的RestrictedPython脚本中可以正常工作

本文发布于:2023-07-16 22:59:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1126825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   工作   Logger   Plone   RestrictedPython

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!