[Zope3-Users] object hierarchy

FB fbo2 at gmx.net
Wed Mar 14 15:35:20 EDT 2007


On Wed, Mar 14, 2007 at 04:35:53PM +0100, Ivan Horvath wrote:
> Dear All,
> 
> i'm really new to zope, but i have learning application, where the
> object stru is little bit complex.
> 
> App
>  |
>  +---- Categories
>                |
>                +------Categ1
>                             |
>                             +----Type1
>                                       |
>                                       +-----Article1
>                                                  |
>                                                  +------Article2
>                             +-----Type2
> 
>                +------Categ2
> +----- Administration
> etc
> 
> i could manage the administration part and in the categories container
> i can add new category objects.
> but i cannot add into a category object a type container.
> i don't really know how to define an interface which is contained and
> container too.

I'm not sure, if I understand your problem correctly. It's possible to
define a set of valid subobjects for each interface:

class IType(IContainer):
   pass

class ICategory(IContainer):
   contains(IType)

class ICategoryContainer(IContainer):
   contains(IType)

[...]

class Type(BTreeContainer):
   implements(IType)

class Category(BTreeContainer):
   implements(ICategory)

class CategoryContainer(BTreeContainer):
   implements(ICategoryContainer)

There's nothing special about those kind of "constraint-trees". Now I'm
guessing: did you forget to specify a <browser:containerViews> and a
<browser:addMenuItem> ZCML-directive per class?

Regards,

Frank


More information about the Zope3-users mailing list