On Sun, Jul 09, 2006 at 10:47:42AM -0700, Siddhartha Azad wrote:

> It updates fine, but I want the update to go through a
> ZPT or some block of code once I press the "Change"
> button (do the POST).
> 
> Do you know if that is possible?

"go through ZPT" as in "redirect to another page"?

if so, you should override nextURL:


    def nextURL(self):
        return "whatever.html"
            


Or, if "go though some block of code" means pre-processing the data you
got, you could do something like:


    def handle_edit_action_failure(self, action, data, errors):
        self.status = 'There have been %d errors.' % len(errors)


    @form.action("Button Label", failure='handle_edit_action_failure')
    def handle_edit_action(self, action, data):

        ....preprocessing here...

        if form.applyChanges(self.context, self.form_fields, data):
            notify(ObjectModifiedEvent(self.context))

            ....postprocessing here...

            self.status = 'Object has been updated'
        else:
            self.status = 'Nothing happened'


_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to