[Zope] Make a Python Products Add list show only certain meta types?

Andrew Kenneth Milton akm@mail.theinternet.com.au
Sun, 13 Aug 2000 02:59:09 +1000 (EST)


+----[ Kapil Thangavelu ]---------------------------------------------
| Kevin Howe wrote:
| > 
| > I have a custom Python class (Container)  which uses Folder as it's base
| > class. I also have a custom Python class (AnObject). I want it so that when
| > you view a Container object, "AnObject" will be the only meta_type available
| > to be added in the Add List. The problem is that since Container inherits
| > from Folder, the Add List makes all object types available to be added. Is
| > there any way to tell a class to show only certain meta_types?
| > 
| > Kevin
| > 
| 
| There is more than one way. The proper way would probably to be adjust
| the security settings on your class in python (filtered_metatypes?). 

The simplest way is to;

    all_meta_types=meta_types=({'name':'Sub Object1',
                                'action':'manage_addSubObject1Form',},
                               {'name':'Sub Object2',
                                'action':'manage_addObject2Form',},)

In your 'base' product.

If you don't register your sub objects in __init__.py you will also
need to import their 'constructors' into your base class, and explictly
declare the icon under misc_


-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|