[Zope-dev] re: Subclassing ZObjectManager in ZClasses
Dieter Maurer
dieter@handshake.de
Thu, 20 Sep 2001 21:58:58 +0200 (CEST)
Daniel Rogahn writes:
> ....
> >Summary: (when creating a folderish ZClass and cascading base classes) if
> >ZObjectManager isn't subclassed at 1st level, objects can be added to the
> >folderish ZClass instances but they don't show in the manage_main object
> list.
I can explain, why it happens. I think it is a bug, at least a mis-feature.
But I cannot change it :-(
"OFS.SimpleItem.Item" provides stupid (!) implementations
of "objectItems", "objectIds" and "objectValues"
(all return the empty tuple).
I do not know, why in hell a non-ObjectManager implements
ObjectManager methods. Because it does, you get the
behaviour you complain about.
"OFS.SimpleItem.Item" is essentially what is called
"ZObject" in ZClasses and what you get when
the "Include standard Zope object behavior" is checked.
When your class (deriving von ZObject) comes before
"ZObjectManager", then its stupid "objectItems"
method is inherited and not that of "ZObjectManager".
This changes, when you switch the inheritance order.
The solution:
"OFS.SimpleItem.Item" should not define ObjectManager methods.
Unfortunately, many "dtml-tree" applications will probably break then.
Affected will be "dtml-tree" occurences with "branches=objectValues".
Dieter