[Zope] Adding ZPT in __init__ method

Peter Bengtsson mail@peterbe.com
Sun, 02 Jun 2002 15:51:41 +0100


--=======5144426=======
Content-Type: text/plain; x-avg-checked=avg-ok-5AE44F62; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit


>
>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

--=======5144426=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-5AE44F62
Content-Disposition: inline


---
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

--=======5144426=======--