[ZPT] Can someone kindly given an example of creating a PageTemplate instance from exteranal method?

Dieter Maurer dieter@handshake.de
Sat, 12 Jan 2002 19:30:37 +0100


iap@y2fun.com writes:
 > I want to create a "dynamic" PageTemplate instance which reads a file in the
 > local file system.
from Product.PageTemplates import PageTemplateFile

class myPageTemplateFile(PageTemplateFile):
  def __init__(self,filename):
    PageTemplateFile(self,filename)
    self.filename= filename

def extMethod(self,filename):
  '''wrap *filename* into a pt.'''
  return myPageTemplateFile(filename).__of__(self)


You should be worried about security....


Dieter