def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return form.context.name = data['name'] form.message('Category has been updated.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return form.context.title = data['title'] form.context.href = data['href'] form.context.color = data['color'] form.message('Link has been updated.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return category = models.Category(name = data['name']) ptah.get_session().add(category) form.message('Category has been created.') return HTTPFound(location='/')
def update_action(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return pprint(data) form.message('Content has been updated.', 'info') return HTTPFound(location='.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return form.context.name = data['name'] form.context.title = data['title'] form.context.tagline = data['tagline'] form.context.discussion = data['discussion'] form.context.disqus = data['disqus'] form.message('Blog has been updated.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return obj = models.RackObject(title=data['title'], label=data['label'], objtype=data['objtype']) ptah.get_session().add(obj) form.message('RackObject has been created.') return HTTPFound(location='/')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return pprint(data) form.context.title = data['title'] form.context.description = data['description'] form.message('Content has been updated.', 'info') raise HTTPFound(location='.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return link = models.Link(title = data['title'], href = data['href'], color = data['color']) ptah.get_session().add(link) form.message('Link has been created.') return HTTPFound(location='/')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return user = ptah.auth_service.get_current_principal().name form.context.creator = user form.context.title = data['title'] form.context.tags = data['tags'] form.context.category = data['category'] form.context.text = data['text'] form.context.discussion = data['discussion'] form.context.modified = datetime.utcnow() form.message('Post has been updated.')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return # form.context is ... form.context.fullname = data['fullname'] form.context.phone = data['phone'] form.context.email = data['email'] form.context.subject = data['subject'] # You would add any logic/database updates/insert here. # You would probably also redirect. log.info('The form was updated successfully') form.message('The form was updated successfully')
def updateAction(form): data, errors = form.extract() if errors: form.message(errors, 'form-error') return now = datetime.utcnow() user = ptah.auth_service.get_current_principal().name post = models.Post(creator = user, title = data['title'], tags = data['tags'], category = data['category'], text = data['text'], discussion = data['discussion'], modified = now, created = now) ptah.get_session().add(post) form.message('Post has been created.') return HTTPFound(location='/')
def loginAction(form): request = form.request data, errors = form.extract() if errors: form.message(errors, "form-error") return info = ptah.auth_service.authenticate(data) if info.status: headers = security.remember(request, info.principal.uri) return HTTPFound(headers=headers, location=request.application_url) if info.message: form.message(info.message, "warning") return form.message("You enter wrong login or password.", "error")
def loginAction(form): request = form.request data, errors = form.extract() if errors: form.message(errors, 'form-error') return info = ptah.auth_service.authenticate(data) if info.status: headers = security.remember(request, info.principal.uri) return HTTPFound(headers = headers, location = request.application_url) if info.message: form.message(info.message, 'warning') return form.message('You enter wrong login or password.', 'error')
def cancel_action(form): form.message('Cancel button', 'info')
def cancel_handler(self): form.message('Cancel button', 'info') raise HTTPFound(location='/test-form.html')