debuggin in zope (was Re: [Zope] XML in Zope)

Dan Shafer pydan@danshafer.com
Sat, 18 May 2002 17:00:58 -0700


Very helpful, Tim. Thanks!

At 12:39 AM 5/19/2002 +0100, Tim Hicks wrote:
>Dan,
>
><snip>
>
> > It will undoubtedly take me some time to come up to speed on all this
> > syntactical stuff, but I'm sure I can grok it. The biggest problem I have
> > trying to code Python scripts in Zope is the virtual absence of debugging
> > tools in the environment.
>
>don't know if this is quite what you meant, but I had some trouble a while
>back trying to debug python scripts in zope.  The problem I found was not
>being able to get hold of tracebacks at certain points.  I made minimal
>product with just the following in the __init__.py
>
>----
>from Products.PythonScripts.Utility import allow_module, allow_class
>from AccessControl import ModuleSecurityInfo, ClassSecurityInfo
>from Globals import InitializeClass
>
>ModuleSecurityInfo('sys').declarePublic('exc_info')
>ModuleSecurityInfo('traceback').declarePublic('extract_tb')
>----
>
>Now, I can import the relevant stuff into python scripts and get hold of
>tracebacks.  I've got things setup in the various scripts so the import only
>occurs if I've got debugging turned on.  Something like
>
>----
>if debug == 1:
>   from sys import exc_info
>   import traceback
>----
>
>Just thought that might help.
>
>tim