def handleApply(self, action): """ Form button hander. """ # data is dict form field name -> cleaned value look-up # errors is a list of z3c error objects which have attribute message # extractData() also sets self.errors by default data, errors = self.extractData() if len(errors) == 0: self.postData(data) ok_message = _(u"Thank you for your comments. Our customer services will come back to you in few days") # Check whether this form was submitted from another page returnURL = data.get("returnURL", "") if returnURL != "" and returnURL is not None: # Go to page where we were sent and # pass the confirmation message as status message (in session) # as we are not in the control of the destination page from Products.statusmessages.interfaces import IStatusMessage messages = IStatusMessage(self.request) messages.addStatusMessage(ok_message, type="info") self.request.response.redirect(returnURL) else: # Act standalone self.status = ok_message else: # errors on the form self.status = _(u"Please correct the errors below")
def title(self): """This property is used to give the title of the portlet in the "manage portlets" screen. """ return _("Comment Form")