Hi Lennart!

Lennart Regebro wrote:
The standard Zope3-ish way is to have a m,ethod called Update() which
you call every time the views template is displayed.

This method can prepare all the data to be displayed, as well as
handle any form postings. Instead of checking on POST I usually check
on the button-presses, but of course if you don't want GET-forms to
work, checking for POST is the right thing to do.

I know that pattern, but I don't like it. While the default action is to display the results of 'Update' in the template of the view, we can't be sure that's the case before we processed the input. It doesn't make sense to invoke the template if we return a redirect.

The code on the goldegg-folder_contents branch processes the input in the __call__ method of the view class. The template is only invoked if needed. It's much cleaner to use the template just for displaying results, not for triggering controllers.



Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to