[Zope-dev] Allowing only specific meta_types to be addable to my product

Dieter Maurer dieter@handshake.de
Thu, 19 Dec 2002 20:11:26 +0100


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