[Zope] Re: Restricting products in add list

Maik Jablonski maik.jablonski@uni-bielefeld.de
Mon, 03 Feb 2003 09:32:35 +0100


Sean K wrote:
> Hi all,
> 
> Is there a way to display in the add list only the
> products you want added to a product that subclasses
> Folder. 
> 
> I have subclassed folder and added methods that add
> other products that are components of the overal
> product. This is to make distribution of the prodcut
> easier and editing contents more visual.

Hi,

you have to define a all_meta_types-method in your Class, which should 
return the allowed meta_types. Something like this should do it:

     def all_meta_types(self):
         ''' '''
         mt = []

         allowed_meta_types=('DTML Document','Folder','File')

         for meta_type in Folder.all_meta_types(self):
             if meta_type['name'] in allowed_meta_types:
                 mt.append(meta_type)

         return mt


Cheers, Maik