[Zope-CMF] Re: Zope-CMF digest, Vol 1 #1105 - 11 msgs
Carl Rendell
cer@sol43.com
Sat, 11 May 2002 10:03:04 -0700
>
>
> Carl Rendell <cer@sol43.com> wrote:
>> 1. when programmatically adding a folder via python script what is
>> the best method? I'm currently adding it via:
>> [...]
>> context.manage_addProduct['CMFCore'].manage_addContent(type='Portal
>> Folder', id='navigation')
>
> This is the normal Zope way of doing things.
>
> The CMF way is to call container.invokeFactory(). For Portal Folders,
> it's the same thing as the Zope way, however for other types defined
> in the Types Tool it is not (because _setPortalTypeName and the
> workflow notifyCreated would not be called).
>
> In general when working with CMF, invokeFactory is always the safe bet.
>
hmm, I see how you would use invokeFactory, though I'm not sure if
the call is to the invokeFactory() from the PortalFolder class, or
somewhere else. It's a bit fuzzy to me at the moment.
>> 2. I'm now used to creating products and setting content filtering
>> attributes in factory_type_information. Can content filters be set
>> arbitrailly at folder creation time, and is that a wise thing?
>
> What do you mean by "set a content filter arbitrarily at folder
> creation time" ?
>
You can set allowed_content_types at the portal_types level by
setting filter_content_types to 1 (true), and providing a list of
allowed portal_types. In essence this restricts what types can be
created within a folder or folder derived product type.
I'm wondering if the attributes that control filtering can be
applied locally such that a portal folder can have individual and
unique lists of allowed content types without having to create a
new portal_type.
Looking at the 'allowedContentTypes' definition in
CMFCore.PortalFolder, it appears that this only uses information
from the portal type.
The reason for the question is, I'm trying to avoid creating a
bunch of portal types just to restrict what type of object can be
created in a particular folder.
~C
Carl E. Rendell
Solution43
Information Distribution Consulting | "Ahhhh the power of
cer@sol43.com | acquisition" - Chef Z