[Zope] Generic add page template fails

Dieter Maurer dieter@handshake.de
Tue, 22 Jul 2003 22:43:15 +0200


Josef Meile wrote at 2003-7-21 17:24 +0200:
 > ....
 > ... DTML works fine ...:
 > manage_addImageForm=DTMLFile('dtml/imageAdd',globals(),Kind='Image',kind='im
 > age')
 > ...
 > I'm trying something similar with ZPT, but it fails:
 > 
 > in my class I do:
 > 
 > manage_addBoringForm=PageTemplateFile('ZPT/addBoring',globals(),Kind='Boring
 > ',kind='boring')
 > manage_addBoringForm._owner=None

Unfortunately, unlike DTML, ZPT do not support default binding definitions
in the constructor.

I work around this weakness through small dispatcher funtions:

PageTemplate= PageTemplateFile(...)

def dispatcherBoring(self,...):
  return PageTemplate.__of__(self)(Kind='Boring', kind='boring')


Keyword parameters passed in this way are available inside
the page template via the predefined "options" variable.


Dieter