You are not logged in Log in Join
You are here: Home » Members » andym » Debugging Zope with Komodo

Log in
Name

Password

 

Debugging Zope with Komodo

Note: please see tested platforms.

Step 1: Install Komodo

http://www.ActiveState.com/Komodo.Komodo requires:

Step 2: Install Zope

http://www.zope.org.

Step 3: Configure Zope to Komodo.

  1. Set the PYTHONPATH to the callkomodo directory, contained in the directory you installed Komodo to.
    • for example if you installed Komodo into d:\Komodo, set your PYTHONPATH to d:\Komodo\callkomodo
    • the base Zope installation does not have a PYTHONPATH installation, you must set it as an Environment Variable
  2. Set an Environment Variable for the host you wish to debug on, variable name: KODEBUG_HOST, the value is the name of the computer you wish to debug on.

Step 4: Debugging an External Method:

  • Open Komodo.
  • Go to the "Debug" menu and select "Listen for Python".
  • Komodo is now ready for the debugging.

In your external method add the following line:

import callkomodo
Anywhere in your External Method you can now call:
callkomodo.brk()
This is a break point that the Komodo debugger will stop at. Run your external method. Use the debugger options in Komodo. Example image: KomodoDebuggerEM.png

Notes:

  1. Currently stopping the debugger means that you have to restart Zope if you want to use it again. Just use go instead.
  2. To have no breakpoints, just comment out callkomodo.brk()

Example: view_source.py

view_source.py is a funky little python script that allows you to browse the dtml source of a Zope installation. This file is available here: ViewSource

Copy this file into the Extensions folder of your Zope installation. Create an External Method, id: view_source, module name: view_source, function name: view_source. Add a breakpoint in the view_source method (don't forget to add in callkomodo).

Example: acquistion fun

You can't actually debug acquisition but you can see the effects up close by looking at the current objects .self variable in Komodo. The easiest way to do this is put callkomodo.brk() in a DTMLMethod:

File: Zope Installation \lib\python\OFS\DTMLMethod
Change: add "import callkomodo" to line 88 Change: add "callkomodo.brk()" to line 166, inside the __call__ method of DTML Method.

Now whenever a DTML Method is called you will get to view the path. Create a confusing set of folders and methods. View a method and Komodo will be called.

Example: debugging DTML

Image: KomodoDebugger.png

Well you can't, but by putting a breakpoint in a DTML Method such as dtml-with you can see the effects of calling one. Be careful though since this dtml is called in the management screen and you will run straight into the debugger. You can see as self changes to the folders as dtml-with pops objects onto the stack.

File: Zope Installation \lib\python\DocumentTemplate\DT_With.py
Change: add "import callkomodo" to line 107 Change: add "callkomodo.brk()" to line 131, inside the render method of With.

Tested with:

Windows 2000 Server
ActivePerl 5.6 (build 620)
ActivePython 2.0 (build 202)
Komodo Beta 1.0 (build 13428), Beta 1.1 (build 14400)
Zope 2.2.5, 2.3b2, 2.3