[Zope-CMF] PortalFolders - 2 questions

Joseph Wayne Norton norton@alum.mit.edu
Sat, 04 Aug 2001 13:14:58 +0900


Tres -

I'm currently doing the following in python.  I have created a file
"ItemImageFolder.py" and have registered it in my Product's
__init__.py file. It works pretty well.

Thanks for your feedback.

regards,

- joe


from Products.CMFCore import PortalFolder

factory_type_information = [{}]
factory_type_information[0].update(PortalFolder.factory_type_information[0])
factory_type_information[0].update( { 'description'           : '''\
Folders used for storing item images.'''
                                 , 'id'                    : 'ItemImageFolder'
                                 , 'filter_content_types'  : 1
                                 , 'allowed_content_types' : ('Image',)
                                 }
                                )
factory_type_information = tuple(factory_type_information)


At Mon, 30 Jul 2001 22:49:16 -0400,
Tres Seaver wrote:
> 
> It is set on a "type" basis (not identical to class).  For instance,
> if I have a FactoryTypeInformation object in 'portal_types', created
> from CMFDefault.NewsItem.factory_type_information, I can require that
> only NewsItems be created in instances created from it, without touching
> the underlying Python class at all.
> 
> 
> >   For example, I would like to limit certain PortalFolders to only
> >    allow for "Images" to be added.  I can think of 2 ways of doing
> >    this currently.
> > 
> >    a. create a new PortalFolder-like python class whose base class is
> >       PortalFolder ... such as PortalImageFolder.  Then use the
> >       type_tool to set allowed_content_types only to "Image".
> > 
> >    b. after adding a PortalFolder set a property such as
> >       "self.allowed_content_types_on_an_instance_basis = (Image,)"
> > 
> >       modify the invokeFactory skin to check for this property hanging
> >       off of each PortalFolderish object and filter based on this
> >       property as well.
> 
> Tres.
> -- 
> ===============================================================
> Tres Seaver                                tseaver@zope.com
> Zope Corporation      "Zope Dealers"       http://www.zope.com
>