[Zope] Prototyped folders?

Jeff Hoffman jeff.hoffman@goingv.com
Tue, 27 Jun 2000 20:46:17 -0400 (EDT)


On Tue, 27 Jun 2000, [iso-8859-1] Hamish Lawson wrote:

> If a folder doesn't itself contain a required object or method, I'd
> like to have another folder looked in instead. The fall-back folder
> won't necessarily (and often can't) be higher in the hierarchy, so
> acquisition doesn't seem to be a solution. 

We do something very similar with our customers, and are in the process of
figuring out the best way to do this kind of thing in Zope. I assume your
aim is to create a 'baseline' site with a number of customized copies. If
you change the baseline, the changes are reflected in its instances,
unless the instance has overloaded the changed aspect.

We have a site (actually 109), built on our proprietary middleware that
do exactly this (check out http://www.pgdc.net).

> Inheritance from a folderish class seems to be one solution, but I fear
> this might lead to an explosion of classes.

Indeed, I believe the same.

> The answer I think I need is to have a protoype mechanism (similar to
> that used in JavaScript and Self). A folder with the requirement to have
> its missing methods looked for elsewhere would be created as an instance
> of (say) PrototypedFolder with a pointer to the folder it wanted to use
> as a prototype. Does such a mechanism exist for Zope?

I achieved something similar to this by using a ZClass mix-in. My mix-in
basically overloaded ObjectManager._checkId to allow me to overload
aspects of a ZClass on an instance-by-instance basis. If the instance did
not overload the method, Zope would fall back to the ZClass's method
definition.

Unfortunately, my attention has been focused elsewhere, lately, and I
haven't had time to flesh this idea out. Getting this to work isn't the
hard part. Getting it to work well, in a way that allows web developers to
(easily) visualize what's going on is, unfortunately, much harder.

I would be interested in pursuing and contributing to an effort to do the
Hard Thinking this will require, done correctly.

> Hamish Lawson
> University of St Andrews, Scotland

--Jeff

---
Jeff K. Hoffman                               704.849.0731 x108
Chief Technology Officer                      mailto:jeff.hoffman@goingv.com
Going Virtual, L.L.C.                         http://www.goingv.com/