class ICover(Interface): title = schema.TextLine( title=_(u"Title"), required=True, ) description = schema.Text( title=_(u"Description"), required=False, )
def handleCancel(self, action): request = self.request response = request.response response.redirect('/@@setupPassword') message = _(u"Cancel this action!") api.portal.show_message(message=message, request=request, type='info') return
class IAd(Interface): title = schema.TextLine( title=_(u"Title"), description=_("Advertising, show at sidebar in homepage."), required=True, ) url = schema.URI( title=_(u"URL Address"), required=True, ) image = NamedBlobImage( title=_(u"Image"), required=True, )
class SetupPassword(form.SchemaForm): schema = ISetupPassword ignoreContext = True label = _(u"Setup Password") description = _(u"Please input account id and password, setup it.") @button.buttonAndHandler(_(u'Setup')) def handleApply(self, action): request = self.request response = request.response data, errors = self.extractData() if errors: self.status = self.formErrorsMessage return accountId = self.request.form['form.widgets.accountId'] newPassword = self.request.form['form.widgets.newPassword'] user = api.user.get(username=accountId) if user: user.setSecurityProfile(password=newPassword) message = _(u"Already setup password!") mType = 'info' else: message = _(u"User not found!") mType = 'warning' response.redirect('/@@setupPassword') api.portal.show_message(message=message, request=request, type=mType) return @button.buttonAndHandler(_(u"Cancel")) def handleCancel(self, action): request = self.request response = request.response response.redirect('/@@setupPassword') message = _(u"Cancel this action!") api.portal.show_message(message=message, request=request, type='info') return
def handleApply(self, action): request = self.request response = request.response data, errors = self.extractData() if errors: self.status = self.formErrorsMessage return accountId = self.request.form['form.widgets.accountId'] newPassword = self.request.form['form.widgets.newPassword'] user = api.user.get(username=accountId) if user: user.setSecurityProfile(password=newPassword) message = _(u"Already setup password!") mType = 'info' else: message = _(u"User not found!") mType = 'warning' response.redirect('/@@setupPassword') api.portal.show_message(message=message, request=request, type=mType) return
class IPubDep(model.Schema): pubdep = schema.TextLine( title=_(u"Published Department"), required=True, )
class ISetupPassword(form.Schema): accountId = schema.TextLine(title=_(u"Account Id"), ) newPassword = schema.TextLine(title=_(u"New Password"), )