[Zope-CMF] manage_addContent error
Tres Seaver
tseaver at zope.com
Mon Oct 20 17:44:40 EDT 2003
On Mon, 2003-10-20 at 17:41, David Chandek-Stark wrote:
> Why do I get an attribute error when calling manage_addContent in a
> python script? As far as I can tell, I'm doing the same thing as adding
> CMFDefault Content from the ZMI.
>
> If the script lives in Portal Folder 'foo', I should be able to create
> in the folder a Portal File 'bar' thusly(?):
>
> container.manage_addContent('bar', 'Portal File')
Try this:
p_disp = container.manage_addProduct[ 'CMFDefault' ]
return p_disp.manage_addContent( 'bar', 'PortalFile' )
The factory method is normally only available in the context of the
"factory dispatcher" of the product.
Note that you will need to change the product name to add content
created by other products (e.g., 'CMFTopic', 'CMFCalendar', etc.).
Tres.
--
===============================================================
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope-CMF
mailing list