[Zope] Python -> ZopePython cheat sheet?
Skip Montanaro
skip@pobox.com
Tue, 5 Nov 2002 10:55:55 -0600
Chris> You can have readline and whatnot by following the steps I
Chris> outlined in my last email instead of going in to the monitor
Chris> client.
The version of Python 2.1 which ships with the Plone MacOSX installer
doesn't have a readline module with it, and doesn't seem to have shipped
with complete sources, so it seemed like six of one half a dozeon of the
other to me. I've just built a readline.so using a source version of 2.1.3.
That seems to work. I don't understand how your scheme works to talk to a
running Zope instance though. I don't have ZEO and by the time I can figure
out how to install and use it, I suspect I will have fumbled around enough
with the monitor client to figure out what I need.
>> Is there some way I can make dir() and type() available to scripts
>> for development purposes and make sys importable once again?
Chris> Not without hacking source,
That seems a helluva a lot easier than some of the other hoops I'm having to
jump through.
Chris> but if you go into ZOPEHOME/lib/python/RestrictedPython, you can
Chris> add them to the "safe_builtins" module-level global. This is not
Chris> recommended. Instead, use an external method or write a Python
Chris> product. See the Zope Developer's guide on how to write a Python
Chris> product and the Zope Book 2.6 edition on how to write an external
Chris> method.
This is as trivial as adding two strings to a list? I don't think so...
I'm only interested in this for my development machine, which is a
single-user machine sitting behind a NAT box. I doubt the security risk is
significant.
>From where I sit it seems Zope needs some serious work on its debugging
capabilities. At a minimum, giving people the option of starting up Zope
with a flag that returns control of their Python interpreter to them would
be a good first step.
Skip