I wrote a recipe for using IPython
via zconsole
to debug Plone
(5.2.8)
It assumes that you have a zeo
Plone installation with 2 clients and client2
will be used for IPython
Create a buildout configuration file ipython-zconsole2.cfg
cd /home/Plone-5.2.8/zeocluster/
cat <<'EOF' | sudo tee ipython-zconsole2.cfg
[buildout]
extends =
develop.cfg
eggs +=
ipython
parts +=
ipython-zconsole2
[ipython-zconsole2]
recipe = zc.recipe.egg
eggs =
ipython
${client2:eggs}
initialization =
from Zope2.utilities.zconsole import debug
print('Binding app via "Zope2.utilities.zconsole.debug()" ...')
app = debug('parts/client2/etc/zope.conf')
print('Starting "IPython.embed()" ...')
scripts = ipython-zconsole2
entry-points = ipython-zconsole2=IPython:embed
[versions]
ipython = 8.4.0
prompt-toolkit = 3.0.30
EOF
run buildout
sudo -u buildout_user bin/buildout -c ipython-zconsole2.cfg
start your zeoserver
and bin/ipython-zconsole2
sudo bin/plonectl start zeoserver
sudo -u buildout_user bin/ipython-zconsole2
in IPython
you can try something like:
In [1]: print(app.title)
Zope
In [2]: plone = app.get('Plone') # <- make sure a Plone instance exists
...: print(plone.title)
Plone
In [3]: from zope.component.hooks import setSite
...: setSite(plone)
...: from plone import api
...: portal = api.portal.get()
...: print(portal.title)
Plone