|
经过一段时间的查找,突然知道如何在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 差不多。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-11 22:21
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社