[Zope] ZClass-within-a-ZClass not in subobjects list?

Tres Seaver tseaver@palladion.com
Sun, 18 Jun 2000 13:28:26 -0400


Matt Behrens <matt@zigg.com> wrote:
> 
> No matter what I do, I can't seem to make a ZClass a subobject of
> another ZClass. I'm really not sure what I'm missing. Here's what
> I've done:
> 
> 1.  Created a new product: WhiteboardProduct.
> 
> 2.  Created a ZClass within that product that inherits from
>     ObjectManager: Whiteboard. Allowed Zope to create all the
>     methods.
> 
> 3.  On Whiteboard's method page, created another ZClass that doesn't
>     inherit from anything: WhiteboardItem.
> 
> If the documentation (ZDG) is to be believed, at this point I would
> have a subobject visible in Whiteboard's subobject list. (It is not
> so.) If I instantiate Whiteboard, I do not get a drop-down list of
> items. Oddly enough, if I select a random item (say, Folder) on
> Whiteboard's subobjects list, I now get a drop-down list of items
> in my instance that does have WhiteboardItem as a choice (of course,
> its meta type, not ``WhiteboardItem'').
> 
> What am I doing wrong here?  This is a 2.1.6 installation that I'm
> playing around on, btw.

There are a couple of items in play here:

 * Nested ZClasses are *always* addable in their containing ZClass,
   so they don't show up as options in the Subobjects tab.

 * If you have *exactly one* nested ZClass in a container ZClass,
   *and* you have not specified any "outside" objects as addable
   on the Subobjects tab, then the only objects which will be
   addable in the container ZClass are instances of the nested one;
   in this case, the management interface does not display a
   dropdown list, but only the "Add" button (try clicking Add on
   your Whiteboard object's Contents tab).

The bad news here is that there are some weirder interactions
possible, as well (several recent Collector issues come to mind);
the good news is that they are almost all related to the UI -- the
underlying object system is pretty sane.

Patches gratefully accepted :)

Tres.
-- 
===========================================================
Tres Seaver                            tseaver@digicool.com
Digital Creations    "Zope Dealers"    http://www.zope.org