コード例 #1
0
ファイル: views.py プロジェクト: qyb/sohu
def show(request):
    """
    show user infomation
    """
    access_token_input = input_for_show_func(request)
    kan_user = KanUser('', access_token_input)
    kan_user.verify_and_login()
    if kan_user.is_logged_in():
        response_dict = extract_class_instance_to_dict(kan_user.get_user())
        response = HttpResponse(serialize(response_dict))
    else:
        response = HttpResponse(serialize(None))
        
    return response
コード例 #2
0
ファイル: views.py プロジェクト: qyb/sohu
def show(request):
    """
    show user infomation
    """
    access_token_input = input_for_show_func(request)
    kan_user = KanUser('', access_token_input)
    kan_user.verify_and_login()
    if kan_user.is_logged_in():
        response_dict = extract_class_instance_to_dict(kan_user.get_user())
        response = HttpResponse(serialize(response_dict))
    else:
        response = HttpResponse(serialize(None))

    return response
コード例 #3
0
ファイル: views.py プロジェクト: qyb/sohu
def update(request):
    """
    update user infomation
    """
    access_token_input, user_info_dict = input_for_update_func(request)
    kan_user = KanUser('', access_token_input)
    kan_user.verify_and_login()
    if kan_user.is_logged_in():
        kan_user.set_kan_username(user_info_dict.get('kan_username', ''))
        kan_user.set_kan_self_description(user_info_dict.get('kan_self_description', ''))
        response_dict = extract_class_instance_to_dict(kan_user.get_user())
        response = HttpResponse(serialize(response_dict))
    else:
        response = HttpResponse(serialize(None))
        
    return response
コード例 #4
0
ファイル: views.py プロジェクト: qyb/sohu
def update(request):
    """
    update user infomation
    """
    access_token_input, user_info_dict = input_for_update_func(request)
    kan_user = KanUser('', access_token_input)
    kan_user.verify_and_login()
    if kan_user.is_logged_in():
        kan_user.set_kan_username(user_info_dict.get('kan_username', ''))
        kan_user.set_kan_self_description(
            user_info_dict.get('kan_self_description', ''))
        response_dict = extract_class_instance_to_dict(kan_user.get_user())
        response = HttpResponse(serialize(response_dict))
    else:
        response = HttpResponse(serialize(None))

    return response