示例#1
0
 def handleCancel(self, action):
     """
     Based on `plone.directives.form.form.EditForm` but with a customized
     redirect url.
     """
     IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"))
     self.request.response.redirect(self.redirect_url)
示例#2
0
    def description(self):
        description = translate(
            _(
                u"variables_form_description",
                default=u"This form can be used to customize a selection of the "
                u"design variable defined in this theme.",
            ),
            context=self.request,
        )

        if not IPloneSiteRoot.providedBy(self.context):
            description += "<br />" + translate(
                _(
                    u"variables_form_description_inheritance",
                    default=u"Variables will be inherited from the ancestors.",
                ),
                context=self.request,
            )
        return description
示例#3
0
    def handleApply(self, action):
        """
        Based on `plone.directives.form.form.EditForm` but with a customized
        redirect url.
        """
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return
        self.applyChanges(data)

        annotations = IAnnotations(self.context)
        annotations[TIMESTAMP_ANNOTATION_KEY] = time.time()

        IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"))
        self.request.response.redirect(self.redirect_url)