[Zope] problems creating a Contents management tab

Max M maxmcorp@worldonline.dk
Wed, 11 Jul 2001 11:33:50 +0200


If you want to limit what objects can be added to youer objectManager just
put this method in your class:

    def all_meta_types(self):
        """ What types can you add to this objectManager? """
        allowedMetaTypes = ('DTML Method', 'DTML Document')
        result = []
        for metaType in Products.meta_types:
            if metaType['name'] in allowedMetaTypes:
                result.append(metaType)
        return result

It does it the "correct" way.

regards Max M

Max M. W. Rasmussen,    Denmark.   New Media Director
private: maxmcorp@worldonline.dk work: maxm@normik.dk
-----------------------------------------------------
Shipping software is an unnatural act

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Bob
> Shelton
> Sent: Wednesday, July 11, 2001 10:38 AM
> To: maxm@normik.dk; polaris@erf.net; zope@zope.org
> Subject: RE: [Zope] problems creating a Contents management tab
>
>
> > I would look in ObjecManager.py / manage_main()
>
> > But try the simple things first. Try removing all your own
> manage tabs and
> > just use the defaults from your parent classes.
>
> > like this:
>
> > manage_options = ObjectManager.manage_options\
> >                         + RoleManager.manage_options
> >                         + Item.manage_options
>
> > If this gives you trouble, you should look elsewhere for your error.
>
> it did give me trouble.
> the solution was to remove 'meta_types' from my class and apparently
> inherit it from ObjectManager.  the method
> ObjectManager.filter_meta_types was attempting to use .has_key('...')
> on my tuple of metatypes (which were strings).  i am unclear as to
> where zope translates these strings to some other object.
>
> as for the manage_options, i used a bastardized version of the Folder
> class'.  it works, but i am still unclear about the details.
>
> -bob
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>