Skip to content

collective/collective.pdbpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Coveralls Codecov Latest Version Package Status Supported Python Versions License

collective.pdbpp

An add-on for Plone that allows you to use pdbpp.

Installation

Install collective.pdbpp by adding it to your buildout:

[instance]
eggs +=
    collective.pdbpp

Then run:

bin/buildout

When your instance starts, you can enter a pdb session by adding the pdb path to any URL, for example:

Features

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'> │
╰─────────────────────────────────────────────────────────────────────────────────╯

Authors

The Syslab.com Team.

Contributors

Put your name here, you deserve it!

Contribute

Support

If you are having issues, please let us know in the issue tracker.

License

The project is licensed under GPLv2.

About

An addon for Plone that does allow you to use the [pdbpp](https://github.com/pdbpp/pdbpp) package

Resources

License

Unknown, GPL-2.0 licenses found

Licenses found

Unknown
LICENSE.md
GPL-2.0
LICENSE.GPL

Stars

0 stars

Watchers

7 watching

Forks

Packages

 
 
 

Contributors