Re: [Zope] Adding ZPT in __init__ method
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() )
But be careful when refreshing your product. Add this to the manage_afterAdd():: if not hasattr(self, 'myid'): add add add
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/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
participants (1)
-
Peter Bengtsson