def update(self, block_id): d = web.input(page_id=None, sizes=[]) form = self.form() if form.validates(d): block = update_block_by_id(block_id, form.d) raise web.seeother(link_to("blocks", block, page_id=d.page_id)) raise form.validation_error()
def create(self): d = web.input(upload={}) form = self.form() if form.validates(d): document = create_document(form.d) raise web.seeother(link_to("documents", document)) raise form.validation_error()
def update(self, page_id): """Update page by id""" form = self.form() if form.validates(): page = update_page_by_id(page_id, form.d) raise web.seeother(link_to("pages", page)) raise form.validation_error()
def create(self): """Create new page""" d = web.input(type="page") form = self.form() if form.validates(d): page = create_page(form.d) raise web.seeother(link_to("pages", page)) raise form.validation_error()
def GET(self, user_id, method): user = auth.get_user(user_id=user_id, is_deleted=True) if user.id != auth.get_user().id: auth.update_user(user.id, is_deleted=method == "delete") if method == "delete": flash.set(_(undo_user_text) % link_to("users", user, "undelete")) applog.info(_(deleted_user_text) % user.title, "users", user.id, "warn") else: flash.set(_(undelete_user_text)) applog.info(undeleted_user_text % user.title, "users", user.id, "warn") auth.delete_session(user.id) else: flash.set(_(cannot_delete_self_text), "error") raise web.seeother("/a/users")
def update(self, document_id): form = self.form() if form.validates(): document = update_document_by_id(document_id, form.d) raise web.seeother(link_to("documents", document)) raise form.validation_error()