xuhaida76的个人博客分享 http://blog.sciencenet.cn/u/xuhaida76

博文

如何debug plone

已有 1286 次阅读 2022-2-27 17:11 |系统分类:科研笔记

经过一段时间的查找,突然知道如何在shell的情形下调试plone:

./bin/instance debug
Starting debugger (the name "app" is bound to the top-level Zope object)
...
...
>>>
>>> api.portal.get()  # Will not work 
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/path/to/egg/plone.api.egg/plone/api/portal.py", line 82, in get
    'Unable to get the portal object. More info on '
CannotGetPortalError: Unable to get the portal object. More info on http://docs.plone.org/develop/plone.api/docs/api/exceptions.html#plone.api.exc.CannotGetPortalError
>>> plone = app.get('my-plone-site')
>>> plone
<PloneSite at /my-plone-site>
>>> from zope.component.hooks import setSite
>>> setSite(plone)
>>> from plone import api
>>> api.portal.get()
<PloneSite at /my-plone-site>

上面代码收集于stackoverflow,真是有用,跟flask shell 差不多。




https://blog.sciencenet.cn/blog-1251937-1327287.html

上一篇:senaite开发环境的设置
下一篇:读书笔记:《Octave程序设计》
收藏 IP: 60.191.58.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-7-11 22:21

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部