Michel (& Andrey), it works! Thank you very much. Awesome. Now I see how Zope is loaded: through a package (directory and __init__). Cool. Yes, Michel, what you suggest is what I'm really looking for (and even better than I hoped). Thank you for the clear explanation. I looked back at Andrey and can understand more of what he's doing (but I'll take baby steps for now). Getting zope running on the prompt is what I needed. I'll write up the how-to and post as soon as I can (I hope this weekend...). Thanks again, = Joe = "michel@digicool.com" wrote:
-----Original Message----- From: Joe Grace [mailto:Occam@Wizards.com] Sent: Thursday, January 06, 2000 6:32 PM To: zope@zope.org Cc: occam@serv.net Subject: [Zope] Testing products outside of zope (i.e., in python interpreter)?
Hi,
is there a way to test zope products outside of zope?
If your code is not Zope depenent, you can. If your code it, you can use the Zope debugger (based on the Python debugger) but at that point you are not 'outside of Zope', you are just not accessing it through the web, but via a debugger prompt.
I find that I'm restarting zope just to update my product and test it, and that seems painfully slow. I'd like to just run code outside of zope interactively in a shell. Is that possible?
Yes.
I'm trying with Boring product (super simple) and tripping over the Persistence import
Import Error: cannot import name Persistent
I've run into this problem before and assume that Persistent is a C function.
It is an ExtensionClass written in C, yes. To get around this you need to 'import Zope'.
How do I make it available to my python interpreter? I couldn't figure out where z2.py gets it, but I also am just dealing with the python environment for the first time. I'm using Xemacs (on NT) if that makes giving some tips any easier. :-)
Yep. Open a shell buffer in your lib/python directory. In my Zope, I have an object in the top level folder called 'Catalog', which is a ZCatalog object.
[michel@korak python]$ python1.5.2 Python 1.5.2 (#1, Jul 5 1999, 14:47:37) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Py$ import Zope, ZPublisher Py$ root_folder = Zope.app() Py$ root_folder.Catalog <ZCatalog instance at 84f77c0> Py$ root_folder.Catalog() [] Py$
-Michel