[Zope] bug in ZClasses: Folderish ZClass shows wrong "subobjects" meta_types

Danny William Adair danny@adair.net
Thu, 17 May 2001 17:00:40 +1200


Hi!

For my folderish ZClass I find "subobjects" in the management screen to 
determine which objects are allowed to be added inside my ObjectManager. 
The "subobjects" tab shows me a list of meta_types to choose from, so that 
I can make sure I don't get a "the object xyz doesn' t support this 
operation" when creating/pasting objects of that metatype.

But the list is faulty! :-o

:-o

1) Created folderish ZClass "Universe" ,metatype "Hello Universe"
2) Created folderish ZClass "World" ,metatype "World"
3) Added "World" to the allowed subobjects list of "Universe"

That's ok. Works as expected. Now let's say I find out that "World" is a 
bad meta_type (there can be several reasons for this, for example someone 
else has just released a wonderful product, which instantiates "World" objects)

Now...

4) Changed the metatype of ZClass "World" to "Hello World"
5) Damn, *now I can't add any World instances in my Universe instances 
anymore* :-(
     So, then Universe's "allowed subobjects" list wasn't adjusted 
automatically... mmmh, ok. Then I' ll do it manually.
6) Right, go to ZClass "Universe" and look under subobjects to correct the 
entry...

Boing!

I only find "World" in the list, although this metatype shouldn' t exist 
anymore. But I can' t find the new metatype, "Hello World", and so I will 
never ever again be able to add them in a Universe instance. Can anyone 
reproduce this misbehavior?

Now, how can I fix this once it has happened? I love "Hello World" and I 
hate "World", so how can I get it back?
My first attempt was to rename the ZClasses and add new ones... bang.

"The permission Add Hello Worlds is already defined."
Ok, break, this will get way to complicated...

So then, I would call this a bug in ZClasses, can somebody confirm this?

     def possible_meta_types(self):
         return self.aq_acquire('_product_meta_types')+Products.meta_types

This is what the management screen calls to show me the wrong list, maybe 
someone knows what's happening here and how to fix this?

tia,
Danny

P.S.:
- Zope 2.3.2 (binary release, python 1.5.2, win32-x86) , Python 1.52
- yes I flushed cache, packed db and restarted zope in between