[Zope] hide nested classes in a python products -- how?

Tino Wildenhain tino@wildenhain.de
Mon, 11 Nov 2002 20:35:17 +0100


Hi,

--On Montag, 11. November 2002 19:14 +0100 Tobias Herp <THerp@apriori.de> 
wrote:

> Hi,
>
> I'm re-implementing my nested ZClass product as a python product.
>
> The ZClass product contains a class 'portal' which is the only one which
> should be add-able to any ordinary folder, and a cascade of further
> classes which can be added inside the portal.
>
> In my classes I'm able to restrict the list of contained classes via
> _allowed_meta_types. But in an ordinary Folder, any object can be added.
>
> Is it possible to prevent the further classes to show up in the normal
> list, so that only 'portal's can be added to a normal Folder object? Or is
> the only solution to throw an exception?

If you only use:

from ZClasses import createZClassForBase

createZClassForBase( base_class=YourProduct.HiddenBaseClass, pack=globals()
                   , nice_name='YourHiddenBaseClass', 
meta_type='YourHiddenClass' )


you can derive from your class in ZClasses, but they dont show up in
the add list.


HTH
Tino Wildenhain