[Zope] [ADVANCED] How do YOU guys do many-to-many in Zope without
relational?
Michel Vayssade
michel.vayssade@utc.fr
Tue, 23 Oct 2001 10:13:28 +0200 (MET DST)
On Mon, 22 Oct 2001, Max M wrote:
> I basically have two zClassses. students and subjects. There can be many
> subjects, and in any subject there can be any number of students.
.......
in such a case I will do it that way :
each student_object will have a unique id, say "stu_01234"
each subject_object will have a unique id, say "suj_56789"
each student_object will have a list of subjects were he applied :
['suj_56789','suj_567','suj_512',...]
if a subject is deleted
you can protect your code by :
creating a global_subject_list (permanet or dynamic)
global_subject_list.has_key[a_subject]
or you can write your own "delete_subject" fonction which will
remove from student lists the delete subject
the uniques ids act has an indirection allowing to modify the object
without breaking any link
....
--
_/ _/ _/_/_/ _/_/ Michel.Vayssade@UTC.fr Service Informatique
_/ _/ _/ _/ T:33/0-3.44.23.49.24 Universite de Technologie
_/ _/ _/ _/ F:33/0-3.44.23.46.77 BP 20.529 60205 Compiegne
_/_/ _/ _/_/ _ mv@utc.fr __/www.utc.fr/~vayssade____ France