Class Instances in Zope

Paul Everitt paul at digicool.com
Sat May 15 09:03:10 EDT 1999


Andrew Cooke wrote:
> 
> Hi,
> 
> I've been looking at the description of Zope on the web site and I'm a
> bit confused about the separation of classes and instances.
> 
> I'll write down what I understand in the hope that it makes clearer
> what I do not know:
> 
> A URL seems to be mapped to an object chain - this is not an
> inheritance hierarchy, but does have something similar in the form of
> acquisition.  It seems, to me, that the "/" in the URL are,
> effectively, replaced by "." in Python.  These objects are
> automatically backed up by a database system that gives them
> persistency and versioning (very neat).

Well put.
 
> However, what I can't grasp, is where self/this comes from.  Do class
> instances appear at any point?  Do different users seem the same
> instances, or is it possible, say, to map individual instances to
> particular users?  (I'm assuming that instances do exist somehow - or
> does the URL map to a single huge structure?)

There is a root object that is an instance of a container superclass
which is "folderish".  In the top folder you have instances of items
such as documents and instances of more containers (subfolders).

Various things can be "folderish".  The Control Panel is folderish.  The
theaded discussions are folderish.  You can write your own kinds of
objects (Products) that can be added to a folder and provide folderish
behavior.

They are definately not one big structure.  Zope objects are loaded into
memory on demand and their subobjects are loaded as "ghosts" (very small
representations).  As you traverse the object system you are loading new
objects into the cache, along with the ghosts the object contains.  If
the cache gets full, something gets unloaded.

Finally, you can always go into Zope from the command line and grab the
top-level object, then navigate the "folder" system as traditional
Python objects (using the dot notation).
 
Make sense?

--Paul




More information about the Python-list mailing list