Thanks Markus! That helped a lot. Now I am trying to display the fields of each container (age, name, etc). But i think i will figure it out. It is just that the Zope's learning process is not that fast for me!
Best regards. Jeronimo 2008/8/8 Markus Kemmerling <[EMAIL PROTECTED]> > Am 08.08.2008 um 17:24 schrieb Jeronimo Jacobo: > > > Hi >> I am new in Zope 3 world, i have read the book " Web Component Development >> with Zope 3" and I am designing a Zope application which involves a >> multiple-level object structure in which the father class has multiple >> instances of son class and the son class has multiple objects of the >> grandson class. >> Up to now i have managed to construct something like this: >> >> class IGrandson(Interface): >> age=Int( >> title=_(u'Age'), >> description=_(u'The age of the Grandson'), >> required=True >> ) >> name=TextLine( >> title=_(u'Name'), >> description=_(u"The name of the Grandson"), >> required=True >> ) >> >> class ISon(Interface): >> name=TextLine( >> title=_(u'Name'), >> description=_(u'Name of the Son'), >> required=True, >> ) >> grandsons=List( >> title=_('Grandsons'), >> description=_("A list of Grandsons"), >> required=False, >> value_type=Object( >> title=_('Grandson'), >> schema=IGrandson >> ) >> ) >> >> However, in this way i can only create Sons. Grandsons will be added as an >> element of the Son''s grandsons list. If I want to create a Grandson without >> father, how can I add it later to the Son''s list? >> >> Is the List the most effective way to store objects? I have tried with >> BTrees, but then i have problems to construct the widgets and views to add >> elements to the BTree and i think BTrees is not an interfaces so I cannot do >> something like: >> >> grandsons=OOBTree( >> title=_('Grandsons'), >> description=_("A list of Grandsons"), >> required=False, >> value_type=Object( >> title=_('Grandson'), >> schema=IGrandson >> ) >> ) >> >> nor >> >> grandsons=Object( >> title=_('Grandson'), >> schema=OOBTree >> >> ) >> >> Also, considering that the structure can grow up to four generations >> (granpa, father, son, grandson), what will be the best approach to achieve >> this mult-level structure? >> >> My initial idea was to present in the first view the Granpas. When >> selecting one of them, its attributes will be shown, among them its sons >> (the Fathers). Then when selecting one of them, the process will repeat >> until the grandson. >> >> I appretiate much your help and ideas. Thanks in advance. >> >> Jeronimo >> > > You could implement everybody as a container for objects of the same type > as the container itself, something like this: > > IGenealogy(IContainer): > ... > > IPerson(IContained, IContainer): > contains('. IPerson') > containers('. IPerson', IGenealogy) > > age=Int( > title=_(u'Age'), > description=_(u'The age of the Person'), > required=True > ) > > name=TextLine( > title=_(u'Name'), > description=_(u"The name of the Person"), > required=True > ) > > This way the father-son relation will only be a matter of the parent-child > relation and not a feature of the defining interface itself (some day every > son may become a father himself ;-). > > Regards, > Markus Kemmerling > >
_______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users