On Mon, 2002-11-04 at 20:09, Skip Montanaro wrote:
This part is frustrating. Stuff seems to be scattered all over the place. Part of my frustration is that when I find something that looks promising I generally have to figure out what the page template equivalent of a dtml example is. I really don't want to wade into dtml again. I used it for a few years outside of Zope and didn't like it.
Uh huh. Stuff is scattered all over the place. The Zope Book is a best-effort attempt at bringing a lot of it together.
Chris> Were you successful at accessing your Zope objects in a Python Chris> prompt?
Yes, thanks. I can get to the static stuff without too much trouble using the medusa/monitor_client script. It's a tad frustrating to not have readline, but I guess that's the price I have to pay for using a canned install on a not-quite-yet wrung out platform (MacOSX). Perhaps I can coax IPython or pyrepl into working for me. I haven't yet tried submitting a form with several fields. I anticipate that will be tedious.
You can have readline and whatnot by following the steps I outlined in my last email instead of going in to the monitor client. If you're using ZEO, you can even be connected to a database that is currently in use by a running Zope instance. It's particularly nice if you run Zope under emacs shell-mode and have Ken Manheimer's pdbtrack installed. When a pdb session is fired up, it tracks the progress of the code in a separate window.
Is there some way I can make dir() and type() available to scripts for development purposes and make sys importable once again?
Not without hacking source, but if you go into ZOPEHOME/lib/python/RestrictedPython, you can add them to the "safe_builtins" module-level global. This is not recommended. Instead, use an external method or write a Python product. See the Zope Developer's guide on how to write a Python product and the Zope Book 2.6 edition on how to write an external method. - C