Logger在Plone的RestrictedPython脚本中可以正常工作 [英] Logger does on work in RestrictedPython script in Plone

查看:103
本文介绍了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.

http://collective-docs.readthedocs.org/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脚本中可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆