[Zope-dev] RFC: RelationAware class for relations between objects

Jeremy Hylton jeremy@zope.com
28 Apr 2003 14:04:31 -0400


On Mon, 2003-04-28 at 13:44, Gary Poster wrote:
> roche@upfrontsystems.co.za wrote:
> > * Shane Hathaway <shane@zope.com> [2003-04-28 17:09]: 
> > I also think relations shouldn't require Zope and Jeremy sure shows that
> > it can be done in pure python. What I appreciate about this is that it
> > might provide a solution that might be workable with Zope 2 in the
> > interim and Zope 3 later on.
> 
> If we could make this work with Zope 2 and 3 context wrapping 
> somehow--i.e., be able to get a related object in context--then this 
> would be the relationship tool that we need.  Unless we can do that, I 
> only see this model applicable in Zope if we are using a repository-type 
> system--not the standard pattern.

If I understand you, ZODB-level relations are not sufficient.  The
problem is that Zope doesn't care about relations between objects based
on their identity.  Zope cares about relations between objects based on
the paths used to get to those objects; whatever object you find at a
particular path location should be involved in the relation.

> > I have one requirement though and that is that it should work with Zope
> > 2 (not require it). Zope 2 apps are my bread and butter at the moment
> > but for now I am going to assume that Zope 2 works fine with python 2.2
> > and that a descriptor based solution is the way to go.
> 
> I don't think objects with these descriptors can be stored in ZODB 3, 
> though.  Right now this is a Zope 3-only (ZODB 4-only) prospect, AFAIK. 
>    If anybody can shoot that down, it's Jeremy, though. ;-)

We'd have to teach ExtensionClass about descriptors.  I suppose that's
tractable, but hardly worth the effort.  Jim suggested rewriting
ExtensionClass in Python as a new-style metaclass.  That's for some
future version of Zope 2, but sounds promising to me.

Jeremy