[Zope-dev] Debugging Tip
Amos Latteier
amos@aracnet.com
Tue, 30 Mar 1999 10:06:21 -0800
Maybe you know this one already but I didn't.
Did you know that you can fire up Python and import Zope's Main module to
get access to Zope's objects from the comfort of the Python prompt?
1. cd to lib/python, this will make things easier, since you won't have to
add lib/python to your sys.path.
2. start Python (if you're using a binary of Zope, you may want to use
Zope's copy of Python)
3. import Main
4. The Zope app object is Main.app
5. From there you can get at any Zope object.
6. Some objects may be ghosts and will look empty when you do a dir on
them. To load them from the object database, try to access one of their
attributes.
7. If you want to make changes to the database don't forget to call
get_transaction().commit() to commit your changes.
If you really want to mess up your Zope install this will let you do it in
style ;-) Of course you wouldn't be considering this unless your broken
Product already messed things up, so what do you have to lose?
Also, don't forget about the Zope debugger which is a more controlled way
to get access to Zope internals.
Have fun!
-Amos