[Zope] Newbie: creating objects programmatically
Dmitry Dembinsky
dmitry@deluxoft.com
Tue, 13 May 2003 19:10:06 +0200
> When I try to replace the dtml with:
>
>
instance.manage_addProduct['ZopePageTemplate'].manage_addZopePageTemplat
e('memberIndex.pt')
>
> I get:Error Type: AttributeError
> Error Value: ZopePageTemplate
>
A couple of mistakes:
1) The name of page template product is 'PageTemplates', not
'ZopePageTemplate'
2) A name of ZPT constructor is 'manage_addPageTemplate'
So it should be somthing like:
container.manage_addProduct['PageTemplates'].manage_addPageTemplate
('memberIndex.pt')
Note, that it will create a page template with default content.
For other constructor parameters (title, text) peek into the file
$ZOPE_ROOT/lib/python/Products/PageTemplates/ZopePageTemplate.py
(IMHO, looking into the source code gives much more info than reading a
bunch of manuals,
at least if Zope is concerned :)
Dmitry