[Zope] [ADVANCED] How do YOU guys do many-to-many in Zope without relational?

Trevor Toenjes zope@toenjes.com
Mon, 22 Oct 2001 15:57:58 -0400


I just completed a similar project linking 2 Zclasses to cross-reference
each other.
I would like to see another reply to your Q to soft-link zclass instances
rather than using a programmatic list.

> But if someone renames, deletes or moves a subject I am f.*?d Or
> the student
> is. The relation to the subject is invalidated.

Allow someone to rename the "title" property, but not change the ID of the
Zclass instance (lock the ID once it is created, so users cant rename it).
This will retain link integrity.

If they delete the instance, then there is no relationship to maintain
anyway, so who cares, or create a Subject "status" property to throw up an
exception to notate that the Subject is in "delete" status without
deleteding the instance.
-Trevor


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Max M
> Sent: Monday, October 22, 2001 3:44 PM
> To: Zope@Zope. Org
> Subject: [Zope] [ADVANCED] How do YOU guys do many-to-many in Zope
> without relational?
>
>
> I am in the situation where I have to do what corresponds to a
> many-to-many
> relation in Zope.
>
> I basically have two zClassses. students and subjects. There can be many
> subjects, and in any subject there can be any number of students.
>
> What I do now is having a studentlist under each subject. But this doesn't
> really work because any single student can belong to any number
> of subjects.
>
> So if this was an ordinary relational db it would be many to many.
>
> Now I considder making a global student list and then do a
> recursive search
> for subjects in the site, so that each student can be related to a subject
> with a selectbox or somesuch.
>
> But if someone renames, deletes or moves a subject I am f.*?d Or
> the student
> is. The relation to the subject is invalidated.
>
> I have never seen it used, but would it be possible to store the "global
> object id" in a list in a user object, and then get the path to
> the subject
> object from that?
>
> Or should I make the subject a global list to? That way I only
> have to check
> if the object exists or not. Not where it is in the object hierachy.
>
> This sort of defeats the purpose of Zope's tree like structure.
> Doesn't it?
>
> So, how do YOU guys do many-to-many in Zope ?
>
> regards Max M
>
> Max M. W. Rasmussen,    Denmark.   New Media Director
> private: maxmcorp@worldonline.dk work: maxm@normik.dk
> -----------------------------------------------------
> Shipping software is an unnatural act
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )