Ok, so now I can debug zope in emacs, and set breakpoints where I want. Back to the earlier problem! Some breakpoints which I think should get hit, do not get hit. Eg, a breakpoint on my external method. I don't yet know why this happens. *TWO MORE MISC CHANGES: - So that I could run Test.py with the '-t' flag on windows, I changed instances of '/dev/null' to '/zopetest.tmp' - For quicker debugging, I made a change at ExternalMethod/ExternalMethod.py line 244, to reload external methods every time: # SKWM - always reload (todo: check debug flag) # try: f=self._v_f # except: f=self.getFunction() f=self.getFunction(1,1) *SWITCHED TO PDOCUMENTTEMPLATE - I tried again to step through zope's publishing process and into my method.. still haven't quite managed it. - I thought, "well it goes through c code at some point (cDocumentTemplate) and maybe that's confusing the debugger". Not to mention me. So, in order to try pDocumentTemplate, I: - renamed lib/python/DocumentTemplate/cDocumentTemplate.pyd (to hide it); - changed DT_Util.py: #SKWM #except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks class cDocument: pass - made a fix, or at least a change, in pDocumentTemplate.py, line 159 (allowed me to manage Documents again) : #SKWM r=str(inst) r=str(inst) - And now, zope appears to run fine using the pDocumentTemplate and I can step through it as far as I want. As before, some breakpoints which I would expect to get hit, don't. - With one exception - running with pDocumentTemplate appears to break access control. Same with BOBO_DEBUG_MODE=1. On with the battle! Advice welcome! -Simon
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
participants (1)
-
Simon Michael