[Zope] Can we execute an external method from outside of Zope

J Cameron Cooper jccooper@jcameroncooper.com
Tue, 27 May 2003 14:10:29 -0500

> I would like to know if we can execute an external method from outside 
> of Zope.
> So let’s say that I have a script “install.py” and an external method 
> “installer” that refers to it.
> Can I execute the external method “installer” in a python script from 
> outside of zope ?
> Can I execute the “install.py” script from outside of Zope but manage 
> to run it as it was under the same context of the external method?
> I actually want to create a script to install a new product and would 
> like the user NOT to create an external method in order to do this…
It took me a little while to figure this out, so let me know if I 
haven't grokked your situation...

1. you cannot run an filesystem-based script from outside of Zope in a 
Zope context.
2. you can execute Zope methods (of any sort) from a regular Python script.
3. you can also execute Zope methods from other tools that can use the 
Zope HTTP interface.


1. There's no (reasonable) way to do this. I suppose you could somehow 
get the script to get Zope on its own, but that's just silly.

2. You can import Zope.app in a Python script and call methods on it. 
This is a standard debugging technique: search the list and web for 
examples. Also loadsite.py that ships with Zope uses this method.

3. You can pretend you're a web browser via automated tools such as 
wget, lynx, curl, Python's urllib2, et al. Using these you can run 
anything on Zope programmatically that you can from the web (and from 
anywhere on the network.)