[Zope3-Users] zopeproject and debugging zope

Lorenzo Gil Sanchez lgs at sicem.biz
Mon Sep 10 12:21:11 EDT 2007


I finally make a quick'n'dirty script to run the debugger. I'll paste it
here justs in case anybody find it useful:

#!/opt/bin/python

import sys
sys.path[0:0] = [
  # lots of eggs
]

import os
import code
import zope.app.debug

banner = """Welcome to the Zope 3 "debugger".
The application root object is available as the root variable.
A Zope debugger instance is available as the debugger (aka app)
variable.
"""

def debug():
    base_dir =
os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
    zodb = os.path.join(base_dir, 'var', 'Data.fs')
    zcml = os.path.join(base_dir, 'site.zcml')
    debugger = zope.app.debug.Debugger(zodb, zcml)

    globs = dict(
        debugger = debugger,
        app = debugger,
        root = debugger.root()
        )
    code.interact(banner=banner, local=globs)

if __name__ == '__main__':
    debug()


It is based on zc.zope3recipes.debugzope, which I couldn't make to work.

Best regards

Lorenzo Gil

El sáb, 08-09-2007 a las 20:27 +0200, Lorenzo Gil Sanchez escribió:
> Hi,
> 
> I recently switched to use zope3 as a library instead as a big
> application where you hook your webapp. Thanks to Philipp for his great
> zopeproject!
> 
> Now I miss something from the old 'bin/runzope' days. I liked how you
> could run an interactive debug session using zope.app.debug.Debugger and
> the command 'bin/zopectl debug'.
> 
> I'm willing to contribute something to zopeproject to add this feature
> but I'm not quite sure about where to start.
> 
> I guess at least an egg with an entry point that starts the debugger and
> another part for the buildout.cfg that uses the zc.recipe.egg recipe and
> that egg need to be done.
> 
> Something I don't understand about the current buildout.cfg file is how
> this part
> 
> [app]
> recipe = zc.recipe.egg
> eggs = PruebasZ3
>        Paste
>        PasteScript
>        PasteDeploy
> 
> ends creating the paster script in the bin directory. I guess I need
> something similar to be able to run the debugger.
> 
> Can anybody give me a clue?
> 
> Lorenzo
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 



More information about the Zope3-users mailing list