[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/Zope Products

nobody@nowhere.com nobody@nowhere.com
Mon, 16 Sep 2002 20:56:18 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Products.stx#4-33

---------------

        If you wish to control which types of objects can be contained
        by instances of your product you can set the 'meta_types' class
        attribute. This attribute should be a tuple of meta_types. This
        keeps other types of objects from being created in or pasted
        into instances of your product. The 'meta_types' attribute is
        mostly useful when you are creating specialized container
        products.

          % Anonymous User - Mar. 27, 2002 8:04 pm - And what is 'a tuple of meta_types' ? A tuple of strings doesn't work...

          % Anonymous User - June 19, 2002 10:09 am:
           The following seems to work:

           meta_types = ( { 'name' : 'Image', 'action' : 'manage_addImageForm', 'permission' : 'Add Image' } , )

           Then you need to define the action 'manage_addImageForm' in your class:

           from OFS.Image import Image
           manage_addImageForm = Image.manage_addImageForm

          % Anonymous User - Sep. 16, 2002 8:56 pm:
           This method appears to add an object type, not restrict the types that can
           be contained.  Does anyone have a method that actually works properly in Zope 
           2.5.1?