[Zope-dev] Re: Objects with multiple parents and storage flexibility, ZPatterns?

Steve Alexander steve@cat-box.net
Wed, 03 Jan 2001 18:04:15 +0000


Chris Withers wrote:

> Hi,
> 
> Once again I'm back at trying to solve this problem, hopefully with a
> little more knowledge this time ;-)
> 
> What I'd like:
> 'Zope' objects of type 'X', which can have multiple parents and can
> contain other objects of type 'X', where storage isn't necessarily tied
> to the ZODB but where the objects have a normal properties page (in
> terms of use, again, it'd be nice if it could be stored anywhere) and
> participate in all the normal Zope security and management interface
> processes, and they need to be catalogable.
> 
> This sounds like ZPatterns to me, am I right?
> 
> If so, it appears there are two choices:
> 1. Folder w/Customiser Support (FwCS ;-) and DataSkins
> 2. Specialist with one or more Racks and DataSkins
>
> Which one of these would be most appropriate?

If you use a Folder w/ Customizer Support, you'll need to create all the 
DataSkin instances in the ZODB, just as if they were normal ZClass (or 
whatever) instances. Thus, the instances all need to be "in there" to 
start with. You can't add data to your external database, and expect a 
new Dataskin instance to pop up in the ZODB. This is what is meant by 
"When using Folder with Customizer Support, DataSkins are anchored in 
the ZODB".

> FwCS containg DataSkins that also mix in the Folder class sound like
> they'd give a closer approximation to 'real Zope objects', but Racks
> sound like the only way that objects of the same metatype can come from
> different sources (eg, some objects of type 'X' from ZODB, some from
> SQL, some from LDAP ,etc) and seem to be more flexible in general, but
> can I have DataSkins that nest stored in a specialists' rack, eg:

You can get the data for your dataskins from a variety of sources, 
whether you choose to use Specialists or Folder w/ Customizer Support.

However, if you use Specialists, you can have the DataSkin instances 
appear only when requested. Thus, you can add records to your external 
database, and thereby have new Dataskins available from your application.

> http://server:8080/specialist/dataskin1/dataskin2
> 
> How about doing something like:
> 
> http://server:8080/specialist/dataskin1/dataskin2/manage

You can do this by providing the __bobo_traverse__ protocol, using 
SkinScript in your Specialist to give objects of the type of dataskin1 
an appropriate __bobo_traverse__ method.

I briefly described this on zope-dev a couple of days ago.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net