[Zope] Help: ZPT + Product Devel: How do I call a PageTemplateFile from a manage_addMyProduct() function?

Dieter Maurer dieter@handshake.de
Fri, 8 Mar 2002 20:49:36 +0100


jkinsley writes:
 > ...
 > def manage_addMyProductForm(client, REQUEST, *args, **kw):
 > 	"""Returns form to add My Product."""
 >      ....
 > 	form=PageTemplateFile('forms/manage_addMyProductForm.pt', globals(), 
 > 			      __name__='manage_addMyProductFormTmpl')
 > 
 > 
 > 	# Here is where my problem is. 
 > 	# This fails with an AttributeError on other in 
 > 	# Shared.DC.Scripts.Bindings._getTraverseSubpath
 > 	# Where REQUEST.other is used.
 > 	return form(client, REQUEST, 
 > 		    args=args, 
 > 		    pass_test1=pass_test1,
 > 		    pass_test2=pass_test2)
PageTemplates are not called like DTML objects.

Try:
	return form.__of__(client)(args=args,pass_test1=pass_test1,...)

 > Finally in the form template, I want to be able to do something like 
 > this:
 > 
 > <tr tal:condition="not:pass_test1">
What you pass in as arguments is available inside the page template
as contents of "options", i.e. the above reads:

   <tr tal:condition="not: options/pass_test1">


Dieter