[Zope3-Users] "has a" relationships

Jachin Rupe jachin at voltzsoftware.com
Thu May 4 17:16:38 EDT 2006


hi there

I have another "zope theory" question.  I am working on designing a  
application in zope.  I've been looking at a lot of examples and I am  
wondering how people are implementing different types of  
relationships between different persistent objects.

For instance I am going to be doing a lot with addresses.  Naturally  
it would be nice to have persistent Address class.  Then I would say  
that a Person has an Address and a Company has an Address.

My two different ideas are as follows:

1.  Make Person and and Company containers that can each contain an  
Address.  I don't really like this idea because it seems like  
container objects are for things like folders.  This could be the  
best way though and I'm just not zoppie enough yet.

2.  Add an Object for the Address to the schema for IPerson and  
ICompany (assuming I only need one address) or a List / Dict (if I  
want more than one address for each person or company).  I like this  
idea better but I have yet to see any examples where someone does  
that which is making me a little nervous.   Among other things I'd  
like to be able to see what happens when "addform"s and "editform"s  
get generated for things like this or at least be assured that's the  
way it is supposed to work.

I just got my very own copies of the "Zope 3 Developers Handbook" and  
"Web Component Development with Zope 3" (I'd suggest these books to  
anyone by the way).  I have given each a once over as well as looking  
at lots of shorter tutorials / examples online and have not noticed  
any example projects doing anything like my second idea.

So in your answer please feel free to point out something in either  
of those books (I may have missed) or refer me to some other online  
example where something like this is going on.

thanks

-jachin


More information about the Zope3-users mailing list