[Zope] publishing objects

Amos Latteier amos@aracnet.com
Tue, 20 Apr 1999 09:32:51 -0700


At 09:18 AM 4/20/99 -0600, Scott Lewis wrote:

>the docs talk about publishing objects, 
>with zope translating URLs to method calls. i get the impression 
>that i can call arbitrary Python objects through zope, but i can't get 
>it to work. i've tried it with IIS and the included HTTP server.

Yes it's true. Zope can publish arbitrary Python objects. Actually, it's
more accurate to say that Zope ORB (ZPublisher) can publish arbitrary
Python objects.

For more info see:

  http://www.zope.org/Documentation/Reference/ORB

Or check out the ZPublisher package in the sources.

Now that you've read up on object publishing, question becomes, how to get
ZPublisher to publish your objects.

The easiest way to publish your Python module with ZPublisher is to run
ZopeHTTPServer like so:

  ZopeHTTPServer.py myModule.py

Now go to the web and try calling your module which should be published on
port 9673.

After you get this working, your next questions may be, "How can I use a
different web server, say Apache." Followed quickly by, "How can I get my
arbitrary Python objects into the Zope framework that I know and love?"

The answer to the first question is PCGI. PCGI, like ZopeHTTPServer lets
you publish any Python module with ZPublisher.

  http://starship.python.net/crew/jbauer/persistcgi/

Now suppose you want to use your objects within the Zope framework. You
have a couple options:

  * External Methods
  * Write a Product

Both these methods are laborious when seen in comparison with just writing
a Python module and publishing it. Why is it so hard? Because the Zope
framework (by which I mean the management conventions and built-in objects
like Folders and DTML Methods) is complex. To make your objects play by its
rules takes an effort. Not only that, but our developer documentation is
still rather crummy.

Some people decide that the Zope framework doesn't offer them compelling
value. They stick with homegrown Python modules and ZPublisher. Other
people find the Zope framework quite useful and so focus on developing
Python code that works within the framework. It's your choice.

If you're interested in developing for Zope you should check out the
External Method documentation and the Product API tutorial.

Also the Zope Manager's Guide explains the process of creating a Product
through the Control Panel which will become much more interesting with the
release of ZClasses (which are now in CVS).

Good luck.

-Amos