[Zope-dev] PROPOSAL: ZODB Relationships

Max M maxm@mxm.dk
Fri, 09 May 2003 11:18:23 +0200


Lennart Regebro wrote:

> roche@upfrontsystems.co.za wrote:
>
>>     http://www.zope.org/Members/upfront/ZODBRelationships
>
>
> Very interesting. What I miss is a way to name the relationship so you 
> can specify which relationship you are interested in. That just 
> fuzzily specify that object A has some sort of relationship to object 
> B doesn't seem very useful...
>
> The typical use of a relationship storage is to ask the relationship 
> repository for all students for a course. But if the relationship is 
> only stored as 'there is a relationship', then all teachers would pop 
> up to.


When using mxmRelations you have a folder called "relations" in this 
folder you put different instances of the mxmRelations class. So you 
would in effect have:

relations/
    students_classes
    teachers_classes

Then you would find the students by:

context.relations.students_classes.get(some_course)

which will then return a list of all students.

regards Max M