[Zope] Adding ZPT in __init__ method
Stuart Bishop
zen@shangri-la.dropbear.id.au
Sun, 2 Jun 2002 13:42:18 +1000
On Friday, May 31, 2002, at 06:00 PM, Nico de Boer wrote:
> 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?
Firstly, you need to do it in a manage_afterAdd(self,item,container)
method:
def manage_afterAdd(self,item,container):
''' Add a PageTemplate customizable by the site manager '''
self.manage_addProduct['PageTemplates'].manage_addPageTemplate(
'myid',text=open(filepath).read()
)
Having methods like 'manage_addDTMLMethod' available from every folder
has been discouraged for quite a while due to collisions on this flat
namespace.
--
Stuart Bishop <zen@shangri-la.dropbear.id.au>
http://shangri-la.dropbear.id.au/