Forum OpenACS Q&A: Response to Article on ACS x Zope

Posted by Chris McDonough on

Here's an example of creating an object in the ZODB from the Python command line (any storage type will work, you needn't worry about it, it's configured at a lower level):

import Persistence.Persistent
import Zope
app =

class Foo(Persistence.Persistent):
   def __init__(self, bar): = bar

app.my_fooinstance_one = Foo(1)
app.my_fooinstance_two = Foo(2)

app.my_sequence_one = ['a', 'b', 'c']
app.my_sequence_two = [1, 2, 3]

app.my_mapping_one = {'a': 1, 'b':2}

For DTML, I could make make a constructor method in Python named "manage_addFoo" for this class and would call it like this:

<dtml-call "manage_addFoo(1)">

The prior was just an explanation of how it works, to use Zope you don't need to know any of this. You install it, visit the "Windows Explorer-like" management interface through any web browser, log in, hit a dropdown box, and pick something you want to add (a DTML method, a Foo instance, a Portal, a mailhost, a Python method, whatever).

All management of Zope can be performed through the web aside from building disk-based Products (though you can build ZClasses, which can be part of through-the-web products), and things that could potentially circumvent the security interface, like arbitrary Python in an external method (though Evan Simpson has come up with a way to add restricted Python code through the web that doesn't circumvent the security system. It has the unfortunate name "Python Methods"). Most Zope content stored in the ZODB can also be accessed via FTP and WebDAV as well.

To get started, most application developers need to start by understanding DTML (this will take them a long way alone, but needs better documentation badly), then they should probably get to know Python (depending on their need to customize existing packages), then they should get to know ZClasses and other methods for building Zope Products.

Some of the more nonobvious things about Zope stem from the fact that instances (like DTML methods, which are just really HTML with fairly simple presentation logic, like for loops and if statements) aren't files on the filesystem, and people seem to have problems adapting to that. Jonothan Farr has created a product named LocalFS that allows people to use files on the filesystem as sort of pseudo Zope objects.

On an even higher level, aplplication developers can abstract out the Zope management interface entirely, allowing users to interact with the system in any way that the app developers define while still making use of the security system, DTML, and member-contributed products like "Squishdot" (a forum product not unlike this one but with a lot of extra fluff that I'm not really all that fond of), WorldPilot (an IMAP-to-web email web gateway), Banner Ad Product, The Wampum Generator (a credit card validation system), the Portal Toolkit (a community contribution and content management system), and other stuff. A full list of Zope Products is available at http://www.zope.rg/Products. I just looked and it looks like there are about 150 prebuilt products for Zope, most member-contributed.

BTW, none of this stuff has any lower-level dependencies, it can happen on Windows with FileStorage, on Linux with a RelationalStorage, on Solaris with ZEO, or any combination you choose.

Anyway, I'll shut up now, hopefully you get the idea.