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

Chris Withers chrisw@nipltd.com
Thu, 04 Jan 2001 11:49:58 +0000


Thanks... this sounds a lot like what I'm after :-)

Steve Spicklemire wrote:
>    I think that if you make your DataSkins folderish it will be hard
> to make the storage anything other than ZODB. 

Well, I don't mind the 'skins' being stored in the ZODB, but, as Steve A
mentioned, I _would_ like stuff created in the RDBMS to 'magically
appear' in the Zope side of things. I guess that means FwCS and
folder-subclassing DataSkins are a no-no?

> Let's say your objects have an attribute that
> defines them in the context of their parent (e.g., dataskin2 in your
> example URL),

their id in Zope parlance, right?

> let's call it 'context_id'. You may have six objects
> with the same context_id, but they would all have different parents.

They may each have mutliple parents too ;-)
The point for me is that the id (context_id in your example) is unique
in terms of _only_ the following constraint:
No parent may have more than one child with the same id.
This is actually how the ZODB works except that it objects in the ZODB
may only have one parent (well, at least ZODBs managed with Zope ;-)

> Now.. you could implement a search interface that finds an object
> in context.
> 
> GetObjectInContextOfParent( context_id, parent_id )

might be better if it resolved a path into an object, like Zope does,
hence my keenness to see if there isn't a simple way I can make Zope and
Zpatterns do the bulk of the work, just with the tweaks I need...

> Now for the traversal interface:
> 
>     def __bobo_traverse__(self, REQUEST, name):
>         ob = getattr(self, name, _marker)
>         if ob is _marker:
>             ob = self.GetObjectInContextOfParent( context_id = name, parent_id = self.id)
>             if ob is not None:
>                 return ob
>             raise 'NotFound'
>         return ob

looks good...

> Totally untested of course. ;-) Anyway the idea would be to *not* use folderish
> DataSkins, but to build a hierarchy out of them that could be traversed.

Hurm... I'd love them to have a UI identical to normal Zope
folders/objectmanagers, though, with properties, a security tab, and, in
a dream world, the ability to drop normal DTML methods, python Scripts
and the like into the foldersish objects.

Is this asking for too much? ;-)

Chris