An add-on for Plone that allows you to use pdbpp.
Install collective.pdbpp by adding it to your buildout:
[instance]
eggs +=
collective.pdbppThen run:
bin/buildoutWhen your instance starts, you can enter a pdb session by adding the pdb path to any URL, for example:
When you access the pdb path, you will be dropped into a pdb session where you can inspect the state of your application and debug any issues you may be facing.
You can use all the features of pdbpp, such as syntax highlighting, tab completion, and more.
In addition you will have Plone specific commands available and enhanced display using the rich library.
For example, you will have immediately available plone.api:
(Pdb++) api.portal.get()
<PloneSite at /Plone>and registered_layers() to see the registered browser layers in your Plone site:
(Pdb++) pp registered_layers()
[
│ <InterfaceClass plone.app.z3cform.interfaces.IPloneFormLayer>,
│ <InterfaceClass plone.app.theming.interfaces.IThemingLayer>,
│ <InterfaceClass plone.app.contenttypes.interfaces.IPloneAppContenttypesLayer>,
│ <InterfaceClass plone.app.event.interfaces.IBrowserLayer>,
│ <InterfaceClass plone.app.layout.interfaces.IPloneAppLayoutLayer>
]You can even use self.layers to see just the layers that are active for the current request:
(Pdb++) self.layers
[
│ 'plone.app.z3cform.interfaces.IPloneFormLayer',
│ 'plone.app.theming.interfaces.IThemingLayer',
│ 'plone.app.contenttypes.interfaces.IPloneAppContenttypesLayer',
│ 'plone.app.event.interfaces.IBrowserLayer',
│ 'plone.app.layout.interfaces.IPloneAppLayoutLayer'
]The pp command is customized to use rich for enhanced display of complex data structures, making it easier to read and understand the output.
It also understands Plone specific data structures, such as views,
request, BTrees objects, and displays them in a more informative way.
See, e.g.:
(Pdb++) pp request
╭──────────────────────── <class 'ZPublisher.HTTPRequest.WSGIRequest'> ─╮
│ <WSGIRequest, URL=https://your-site.example/Plone/pdb> │
│ │
│ path = [] │
│ form = {} │
│ other = { │
│ 'SERVER_URL': 'https://your-site.example', │
│ 'URL': 'https://your-site.example/Plone/pdb', │
│ 'PATH_INFO': '/Plone/pdb', │
│ 'ACTUAL_URL': 'https://your-site.example/Plone/pdb' │
│ } │
╰───────────────────────────────────────────────────────────────────────╯You also have an enhanced inspect command (ii) that uses rich to display details of the object you are inspecting, e.g.:
(Pdb++) ii api
╭───────────── <module 'plone.api' from '.../plone/api/__init__.py'> ─────────────╮
│ addon = <module 'plone.api.addon' from '.../plone/api/addon.py'> │
│ content = <module 'plone.api.content' from '.../plone/api/content.py'> │
│ env = <module 'plone.api.env' from '.../plone/api/env.py'> │
│ exc = <module 'plone.api.exc' from '.../plone/api/exc.py'> │
│ group = <module 'plone.api.group' from '.../plone/api/group.py'> │
│ portal = <module 'plone.api.portal' from '.../plone/api/portal.py'> │
│ relation = <module 'plone.api.relation' from '.../plone/api/relation.py'> │
│ user = <module 'plone.api.user' from '.../plone/api/user.py'> │
│ validation = <module 'plone.api.validation' from '.../plone/api/validation.py'> │
╰─────────────────────────────────────────────────────────────────────────────────╯The Syslab.com Team.
Put your name here, you deserve it!
- Alessandro Pisa, Syslab.com
- Issue Tracker: https://github.com/collective/collective.pdbpp/issues
- Source Code: https://github.com/collective/collective.pdbpp
- Documentation: https://github.com/collective/collective.pdbpp#readme
If you are having issues, please let us know in the issue tracker.
The project is licensed under GPLv2.