[Zope3-Users] zope.formlib view action is calling two times ?

Baiju M mbaiju at zeomega.com
Tue Sep 4 02:00:44 EDT 2007


Hi,
   I have a view class like this:

 class EditTestPage(form.EditForm):
    form_fields = form.Fields(ITestPage)
    template = namedtemplate.NamedTemplate('page_edit')
    output = ""

    actions = form.Actions(
        form.Action('Save', success='handle_save_action'),
        form.Action('Preview', success='handle_preview_action'),
        )

    def handle_save_action(self, action, data):
        if form.applyChanges(self.context, self.form_fields, data):
            self.status = 'Object updated'
        else:
            self.status = 'No changes'
        self.request.response.redirect('.')

    def handle_preview_action(self, action, data):
        print "Test"
        self.output = "Test"

When I click 'Preview' or 'Save' button, the actions are called two 
times, any idea ?

Regards,
Baiju M



More information about the Zope3-users mailing list