[Zope] Passing keyword options to PageTemplateFile?

Dieter Maurer dieter@handshake.de
Thu, 13 Feb 2003 21:33:17 +0100


Jon Whitener wrote at 2003-2-12 13:34 -0500:
 > I'm creating a Python product ('MyClass') and attempting to use Zope 
 > Page Templates for the 'manage_*' forms.  In my manage_addMyClassForm, I 
 > want the ZPT to render a multiple selection list (of 'categories') using 
 > a tal:repeat statement which accesses 'categories' through the 'options' 
 > ZPT name.
 > 
 > My problem lies in passing the 'categories' sequence into the ZPT (via 
 > 'options') from the MyClass.py module.  Here's what I have so far:

Me too, I really miss the ability to pass in parameters to
ZPT's at instantiation time (what I can easily do with DTML objects).

I work around this lack through wrapper methods:

       ....
       template= PageTemplateFile

       def T1(self):
         return self.template(a1= v1, a2= v2, ...)

       def T2(self):
         return self.template(b1= w1, b2= w2, ....)
	 


Dieter