[Zope] Adding ZPT in __init__ method
Nico de Boer
nico@nfg.nl
31 May 2002 10:00:31 +0200
Hello,
I want to add a ZPT at initialization (in the __init__ method) of my
folderish product. Why can't I just use:
self.manage_addPageTemplate(id='ZPTid',title='title',text='content')
Can someone give me the right syntax to do this?
I've tried the following, but aq_parent doesn't exists at
initialization of your product (thanks Casey):
parent = getattr(self, 'aq_parent', None)
self._createZPT(parent, 'ZPTidentity', 'title', 'Template')
def _createZPT(self, parent, id, title, content):
"""Add a PageTemplate to the News product"""
parent._setObject(id, ZopePageTemplate.ZopePageTemplate(id, text=content))
getattr(parent, id).pt_setTitle(title)
Greetz Nico