Re: [Zope3-Users] zopeproject and debugging zope

2007-09-10 Thread Lorenzo Gil Sanchez
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@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users
 

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zopeproject and debugging zope

2007-09-09 Thread Lorenzo Gil Sanchez
El sáb, 08-09-2007 a las 16:27 -0400, Benji York escribió:
 Lorenzo Gil Sanchez wrote:
  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'.
 
 If you use the zc.zope3recipes:instance recipe to build an instance 
 (even one that you never start) it will accept a debug command, just 
 like zopectl.

I read
http://svn.zope.org/zc.zope3recipes/trunk/zc/zope3recipes/README.txt?rev=78368view=auto

and tried to use zc.zope3recipes. The instance recipe depends on the
application recipe which I can't get to work. This is my buildout.cfg
file:

[buildout]
develop = .
parts = myapp
find-links = http://download.zope.org/distribution/
eggs-directory = /home/lgs/proyectos/jt-yaco/zope3-eggs
newest = false

[zope3]
location = . 

[myapp]
recipe = zc.zope3recipes:app
site.zcml = include package=pruebasz3 /
principal id=zope.manager
 title=Manager
 login=admin
 password_manager=Plain Text
 password=admin
 /
grant role=zope.Manager
 principal=zope.manager
 /
eggs = PruebasZ3


And this is the error I get when running bin/buildout:

[EMAIL PROTECTED] PruebasZ3]$ bin/buildout 
Develop: '/home/lgs/proyectos/jt-yaco/PruebasZ3/.'
Installing myapp.
While:
  Installing myapp.

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:

NameError:
global name 'logger' is not defined


I'm not sure if this is due to a conflict with my existing buildout
environment created by zopeproject. Nevertheless, I really apreciate
your answer but I was looking to a more integrated aproach with
zopeproject which I like best because it's simpler, at least for newbies
like me.

Maybe the problem with zopeproject and debuging a zope3 application is
that zopeproject uses Paste for the http server instead of zserver or
twisted and that make it harder to use with zope.app.debug.Debugger.

Lorenzo

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zopeproject and debugging zope

2007-09-08 Thread Benji York

Lorenzo Gil Sanchez wrote:

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'.


If you use the zc.zope3recipes:instance recipe to build an instance 
(even one that you never start) it will accept a debug command, just 
like zopectl.

--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users