示例#1
0
class IThemeGallerySettingsSchema(interface.Interface):

    tgserver_url = schema.TextLine(
        title=_(u'Server'),
        description=_(u'URL to reach themegallery server'),
        required=True,
        readonly=False,
        default=u"https://ploud.com/",
    )
 def handleSave(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = self.formErrorsMessage
         return
     changes = self.applyChanges(data)
     IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"), "info")
     self.request.response.redirect("%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))
 def handleSave(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = self.formErrorsMessage
         return
     changes = self.applyChanges(data)
     IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
                                                   "info")
     self.request.response.redirect(
         "%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))
class ThemeGallerySettings(controlpanel.RegistryEditForm):
    schema = IThemeGallerySettingsSchema
    label = _(u'Theme Gallery Settings')
    description = _(u'Define the theme gallery settings')

    @button.buttonAndHandler(_('Save'), name='save')
    def handleSave(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return
        changes = self.applyChanges(data)
        IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
                                                      "info")
        self.request.response.redirect(
            "%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))

    @button.buttonAndHandler(_('Cancel'), name='cancel')
    def handleCancel(self, action):
        IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
                                                      "info")
        self.request.response.redirect(
            "%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))
 def handleCancel(self, action):
     IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"), "info")
     self.request.response.redirect("%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))
 def handleCancel(self, action):
     IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
                                                   "info")
     self.request.response.redirect(
         "%s/%s" % (self.context.absolute_url(), '@@ploud-themegallery'))