Allowing only specific meta_types to be addable to my product
I have created a Product made up of hundreds of classes. Each class has restrictions that should only allow a certain few meta_types to be added. I have tried every method I can find to do this, without luck. I know you can restrict this in a ZClass by defining the addable subobjects. However, I cannot determine how to do this in the python class. Only those meta_types allowed should appear in the Add Drop down list. Thanks in advance, Stacy
Stacy Roberts Ladnier writes:
I have created a Product made up of hundreds of classes. Each class has restrictions that should only allow a certain few meta_types to be added. Give your classes an "all_meta_types" method, similar to the following:
def all_meta_types(self): return ( { 'name' : PortalConfig.meta_type, 'action': 'PortalConfig_add', 'permission': ManagePortal, }, ) I.e. "all_meta_types" should return a sequence of dictionaries. Each dictionary describes an allowed meta type, "name" gives its name (meta_type), "action" the URL to the constructor, "permission", the permission necessary to be allowed to add this meta type. Dieter
participants (2)
-
Dieter Maurer -
Stacy Roberts Ladnier