[Zope] - debugging notes 3: python settings, breakpoints again, debugging in webserver mode
Simon Michael
simon@joyful.com
Tue, 12 Jan 1999 15:38:52 -0800
Hacking on through the zope jungle <chop> <bash> <ouch>
Avoiding a fatal squeeze from certain large snakes <oof>
I wonder if there's an easier trail around here somewhere.
Here are some more brief notes, on the theory that someone may benefit.. or
shoot me before I catch jungle madness..
- PYTHON SETTINGS
I said that "python -u ..." also works when doing "M-x pdb" in emacs. Not
true, stick with "python -i ..." to avoid problems.
Added a whole bunch of zope dirs to the PYTHONPATH environment variable to
allow imports. Works for python 1.5.2b1, but not for zope's python.
- BREAKPOINTS AGAIN
I wrote:
> Ok, so now I can debug zope in emacs, and set breakpoints where I want.
Spoke too soon. pdb's "b filename:lineno" doesn't work. Test.py's fbreak()
function does work. Breakpoints can be configured in a .bobodb file. Eg:
import ExternalMethod
breakpoints = [ExternalMethod.ExternalMethod.__call__,]
Doesn't matter if you use cDocumentTemplate or pDocumentTemplate.
A breakpoint on the external method itself doesn't work. If I step in from
the above, I can then set one that works.
- DEBUGGING IN WEBSERVER MODE
When running in Test.py's command-line mode, the #with statement which calls
my method is initialized but never rendered (why ?). It works fine in normal
webserver mode. I changed Test.py to fire up the whole zopeHTTPserver:
# db.run('publish_module(file,environ=env,debug=1)',Publish.__dict__,
{'file':file, 'env':env})
sys.argv = []
db.run('import serve',Publish.__dict__,{'file':file, 'env':env})
Run Test.py in debug mode with "M-x pdb", as before. It reads breakpoints
from .bobodb (I hardcoded the path to make sure). Continue a few times and
the webserver's running. Access the url with a browser to trigger the
ExternalMethod breakpoint, step into your method and there you are (my holy
grail).
-Simon