[Zope-CMF] PortalFolders - 2 questions
Tres Seaver
tseaver@palladion.com
Mon, 30 Jul 2001 22:49:16 -0400
Joseph Wayne Norton wrote:
> I have 2 questions regarding PortalFolders.
>
> - using FTP - is it possible to specify or turn on/turn off behavior
> of whether a normal Zope Folder or a CMF PortalFolder is created
> due to a mkdir command? My current understanding is that a Zope
> folder will always be created. Documents seem to behave as
> expected.
The ZPublisher FTP machinery makes hooking FTP's MKDIR command extra-
ordinarily hard. Can't be done, at the moment (would be possible under
WebDAV, though, as adding a MKCOL verb for HTTP would be fairly simple).
> - allowed_content_types - what is the best way to support this
> behavior on an instance basis? Currently, this behavior seems to
> be supported only on a class basis.
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