[Zope] ZClass acting up?

Tres Seaver tseaver@palladion.com
Mon, 22 May 2000 22:14:04 -0400


Erik Enge <erik@src.no> asked:
> 
> I have discovered this extremely irritating "feature" with ZClasses.
> 
> Sorry for this long and rather ugly explanation, but I don't know
> what the problem is, so it has to be like this:
> 
> Add test_product product in Control Panel - Product Management
>         In test_product:
>         Add a test_folder zclass with object manager as its base
>          class
>                 In test_folder:
>                 Add test_project zclass with test_folder as its base
>                 class
> 
>         (be sure to enter all factories and press "change")
> 
> Now, enter your Zope tree (http://localhost/, for example) and do:
> 
>         Add a test_folder
>                 In test_folder:
>                 Add a test_project
>                         In test_project:
>                         Add a test_project
> 
>         The point here being to demonstrate that you can add
>         recursively test_projects. Which is nice, I love it..
>         semantics looking nice and all :-).
> 
> Then, go back to the test_product, and in test_project add a Z Class
> thats called test_projectteam, make object manager the base class.
> 
> And finally, enter the test_folder you created earlier and add a
> test_project. Enter this project... now what do you see? Thats right,
> your not able to add test_projects recursively any longer, but you
> can add project_teams (which doesn't really make me all that happy).
> 
> Why is this? I want to be able to structure projects into sub
> projects and be able to divide the project teams working on the
> different projects. Does anyone know why this happens? And possibly
> how I can achieve what I want?


"Kevin Dangoor" <kid@kendermedia.com> replied:
> 
> ----- Original Message -----
> From: "Erik Enge" <erik@src.no>
> 
> > "Kevin Dangoor" <kid@kendermedia.com> writes:
> >
> > > This seems like odd behavior to me. Did you check your Subobjects
> > > tab to make sure that the appropriate subobjects are still
> > > selected?
> >
> > There is no way to select a Z Class that is a child of another Z
> > Class in the subobject list.  Should I be able to do that? Seems to
> > that this was never possible.  All I can select is test_product, but
> > that isn't what I want.  Got a clue?  Is it a bug or functionality
> > that just isn't supposed to be there?
> 
> You're correct, there is no way to select a ZClass that is the child
> of another in the subobject list. (It is assumed to be available).
> 
> I misread your original note. I didn't realize that test_project not
> only had test_folder as a base class, but is a class created
> underneath test_folder. I've never tried to do that, and it may not
> be a case that was considered when they built ZClasses...

Actually, it *is* possible still to add the test_project objects;
the problem is that the management interface is confused about the
list of possible options.  To prove this to yourself, follow Eric's
recipe above, and then invoke the add form directly through the URL,
e.g.:

  <URL
http://my.site/a_test_folder/a_test_project/manage_addProduct/test_product/test_folder/test_project_addForm>

If you fill out the ID and press 'Add', le voilą!

The management interface is using some unhappy heuristics in its
attempt to determine the legal set of addable classes:

 * In the initial case, the only possible item is test_project, so
   it hard-wires the "Add" button to it (and doesn't show a list!)

 * In the second case, the "nested class rule" kicks in before the
   MI gets up to the top of the product, and so the nested "project
   team" class is the only one found;  again, the MI wires up the
   "Add" button directly, with no list.

 * If you had more nested classes, you would see a list of them
   (but still not the project class itself).  Likewise, if you add
   other meta-types to the "Subobject" tab of the class, they will
   appear in the list as well.

This problem is a ZClass bug and should be reported to the Collector:

  http://classic.zope.org:8080/Collector

(Actually it looks like a duplicate of #811).

Tres.
-- 
===============================================================
Tres Seaver       Digital Creations        tseaver@digicool.com