def route_register_view(request): user = current_user(request) result = request.query.get('result', '') result = urllib.parse.unquote_plus(result) return html_response( 'register.html', result=result, username=user.username )
def index(request): """ todo 首页的路由函数 """ u = current_user(request) todos = Todo.all(user_id=u.id) return html_response('todo_index.html', todos=todos)
def edit(request): """ todo 首页的路由函数 """ # 替换模板文件中的标记字符串 todo_id = int(request.query['id']) t = Todo.one(id=todo_id) return html_response('todo_edit.html', todo_id=todo_id, todo_title=t.title)
def index(request): """ weibo 首页的路由函数 """ if 'user_id' in request.query: user_id = int(request.query['user_id']) else: u = current_user(request) user_id = u.id weibos = Weibo.all(user_id=user_id) # 替换模板文件中的标记字符串 return html_response('weibo_index.html', weibos=weibos)
def route_login_view(request): """ 登录页面视图 """ log('login, headers', request.headers) log('login, cookies', request.cookies) user = current_user(request) log('current user', user) result = request.query.get('result', '') result = urllib.parse.unquote_plus(result) return html_response( 'login.html', result=result, username=user.username )
def route_ajax(request): """ 主页的处理函数, 返回主页的响应 """ return html_response('ajax.html')
def route_index(request): """ 主页的处理函数, 返回主页的响应 """ u = current_user(request) return html_response('index.html', username=u.username)
def comment_edit(request): comment_id = int(request.query['comment_id']) c = Comment.one(id=comment_id) return html_response('comment_edit.html', comment=c)
def edit(request): weibo_id = int(request.query['weibo_id']) w = Weibo.one(id=weibo_id) return html_response('weibo_edit.html', weibo=w)