In trying to work out how to traverse from a z3c.form Form for a simple 
scenario, I've uncovered something a little confusing with the Form code.

In my case the user specifies search criteria then gets a results page. 
  I am doing the following;

from z3c.form import form
from import ViewPageTemplateFile

class SearchForm(form.Form):

   # usual stuff

   def @handleSearch(self, action):
     # process criteria and setup for displaying results
     self.template = ViewPageTemplateFile('www/')

Which breaks because of BaseForm's render() method (see comments):

def render(self):
   '''See interfaces.IForm'''
   # render content template
   if self.template is None:
     template = zope.component.getMultiAdapter((self, self.request),
     return template(self) # ** displays ok default edit form
   return self.template() # ** breaks results page no instance

Should the last line be self.template(self) because 
ViewPageTemplateFile.__call__(self, instance, *args **kw) requires a 
single mandatory argument?

Although ViewPageTemplateFile requires an argument, IPageTemplate 
doesn't mandate it so I'm wondering if there were other adapters the 
code's author had in mind when doing this.  It seems a little 
inconsistent to a zope3 novice anyway.

Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to