def POST(self, id): todo = model.get_by_id(id) if not todo: raise web.seeother('/?err=none') data = web.input() if not data.get('title'): return render_without_layout.warning('需要输入内容', '/edit/%s' % id) model.update_title(id, data.title) return render_without_layout.warning('修改成功', '/')
def GET(self, cur_page=1): titlescount = model.get_count_from_titles() eachnum = 10 pages = titlescount // eachnum if titlescount % eachnum != 0: pages = pages + 1 if int(cur_page) > pages or int(cur_page) <= 0: return render_without_layout.warning('没有数据', '/') titles = model.get_todolist_with_limit(eachnum, (int(cur_page) - 1) * 10) return render.pages(titles, cur_page, pages)
def POST(self): data = web.input() email = data.get('email') username = data.get('username') if email and username: if model.check_email(email, username): #验证邮箱和用户名是否匹配 newpassword = model.update_password(username) #更新密码 try: web.sendmail('*****@*****.**', email, u'找回密码', u'您的新密码为%s' % newpassword) except Exception, e: print e return render_without_layout.warning('发送成功', '/login') return render.forget('用户名邮箱不匹配')
def GET(self): return render_without_layout.warning('会话过期', '/login')