Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
def edit(request):
    weibo_id = int(request.query['weibo_id'])
    w = Weibo.one(id=weibo_id)
    return html_response('weibo_edit.html', weibo=w)
Beispiel #6
0
def route_index(request):
    """
    主页的处理函数, 返回主页的响应
    """
    u = current_user(request)
    return html_response('index.html', username=u.username)
Beispiel #7
0
def route_ajax(request):
    """
    主页的处理函数, 返回主页的响应
    """
    return html_response('ajax.html')