Florian Lindner napisał(a):
Am Samstag, 1. April 2006 15:15 schrieb Alek Kowalczyk:
  
Hello,

I have a simple (on the first sight) problem, which I don't know how to
resolve in zope3'ish way.

I have a single object, which can contain many objects of 2 another
types (IType1, IType2). My intention is to have those objects contained
in separate collections (because they are very different 2 types of
objects and should not be mixed in one collection)
I'd like to have each collection editable like Zope folder, i.e each
collection to be IContainer/BTreeContainer.
    

[...]

Hi,
why don't just create two subfolders (of type zope.folder) in you Container 
object, one for IType1, one for IType2?

Regards,

Florian

  
Good idea, thanks! In the meantime I have made something similar, i.e defined two more container types (IObjects1, IObjects2) and created one IObjects1 and one IObjects2 in the IMasterObject's (which now is also a IContainer) constructor .

But now the new question follows:  how to limit cardinality of items? I want now to have one and exactly one IObjects1 and IObjects2 instance in IMasterObject. Is there some type of constraint defined, similar to ItemTypeConstraint, for limiting number of elements of specific type, or I should do it on my own by overriding __setitem__ and other methods?



_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to