Debugging Plone

by Joel Burton last modified May 11, 2010 07:33 PM
Life without debuggers is hard. Here's what you need to know to get a better life.

Debugging

(For a more thorough example of working in the debugger, see Using PDB)

  • Life without debuggers isn't worth living
    • Simple problems get solved in 2 minutes
    • Complicated problems are possible to solve

The Debugger is Your Friend

  • Using debugger with ZEO in Zope 2.7

    zopectl debug will enter the debugger under ZEO.

  • Can examine anything
  • Can execute arbitrary code, change variables, change ZODB

Executing Requests

  • Zope.debug(...)
    • Read documentation on debug with Zope
    • , u="user:password"
    • , pm=1 for postmortem

Playing in the ZODB

Often, even more helpful than debugging is the ability to simple examine your ZODB directly outside of any request or debug-stepping. Once you're used to this, you'll probably find you keep the debugger open all the time while you're developing and debugging, just to quickly see how things are actually created and working in Zope.

  • Most useful feature
  • Can interactively examine and change ZODB outside of debugging
  • The root of ZODB is app

ZODB Changes

  • To commit your transaction: get_transaction().commit()
  • To sync yourself to the current ZODB: app._p_jar.sync()

Graphical Debuggers

  • BoaConstructor
    • Can debug ZODB Python Scripts
    • Can build Zope objects
  • WingIDE
    • Powerful remote debugging
    • Can debug FS-stored Python Scripts
  • Komodo
    • Regex debugging
    • Excellent IDE