当前位置: 首页>>代码示例>>Python>>正文


Python client.Context类代码示例

本文整理汇总了Python中client.Context的典型用法代码示例。如果您正苦于以下问题:Python Context类的具体用法?Python Context怎么用?Python Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Context类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: profile

def profile(user_id):
    # current_user is the login-in user, check whether the current user want to view his own profile.
    current_user = Context.from_object(__get_api(API_USER, {"token": session.get("token")}))
    searched_user = Context.from_object(__get_api(API_USER, params={"user_id": user_id}))
    if "id" in current_user and "id" in searched_user and current_user.id == searched_user.id:
        return redirect("/user/profile")
    return render("/user/profile.html")
开发者ID:RangeForce,项目名称:open-hackathon,代码行数:7,代码来源:route_user.py

示例2: temp_settings

def temp_settings(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session["token"]}
    reg = Context.from_object(__get_api(API_HACAKTHON_REGISTRATION, headers))

    if reg.get("registration") is not None:
        if reg.get("experiment") is not None:
            return redirect(url_for("workspace", hackathon_name=hackathon_name))
        elif reg.registration.status == 1 or (reg.registration.status == 3 and reg.hackathon.basic_info.auto_approve):
            templates = Context.from_object(__get_api(API_HACKATHON_TEMPLATE, headers))
            return render("/site/settings.html", hackathon_name=hackathon_name, templates=templates)
        else:
            return redirect(url_for("hackathon", hackathon_name=hackathon_name))
    else:
        return redirect(url_for("hackathon", hackathon_name=hackathon_name))
开发者ID:xunxunzgq,项目名称:open-hackathon,代码行数:14,代码来源:__init__.py

示例3: hackathon

def hackathon(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    data = __get_api(API_HACKATHON, headers)
    data = Context.from_object(data)
    reg = Context.from_object(__get_api(API_HACAKTHON_REGISTRATION, headers))
    if data.get('error') is not None:
        return render("/404.html")
    else:
        return render("/site/hackathon.html",
                      hackathon_name=hackathon_name,
                      hackathon=data.get("hackathon", data),
                      user=data.get("user"),
                      registration=data.get("registration"),
                      experiment=reg.get("experiment"))
开发者ID:vitan,项目名称:open-hackathon,代码行数:14,代码来源:__init__.py

示例4: temp_settings

def temp_settings(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    reg = Context.from_object(
        __get_api(API_HACKATHON, {"hackathon_name": hackathon_name, "token": session.get("token")}))

    if reg.get('registration') is not None:
        if reg.get('experiment') is not None:
            return redirect(url_for('workspace', hackathon_name=hackathon_name))
        elif reg.registration.status == 1 or reg.registration.status == 3:
            templates = Context.from_object(__get_api(API_HACKATHON_TEMPLATE, headers))
            return render("/site/settings.html", hackathon_name=hackathon_name, templates=templates)
        else:
            return redirect(url_for('hackathon', hackathon_name=hackathon_name))
    else:
        return redirect(url_for('hackathon', hackathon_name=hackathon_name))
开发者ID:ifhuang,项目名称:open-hackathon,代码行数:15,代码来源:__init__.py

示例5: create_join_team

def create_join_team(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session["token"]}
    member = Context.from_object(__get_api(API_TEAM_MEMBER_LIST, headers))
    if member.get('team') is None:
        return redirect(url_for('user_team_hackathon', hackathon_name=hackathon_name))
    else:
        return render("/site/team.html", hackathon_name=hackathon_name)
开发者ID:mshubian,项目名称:open-hackathon,代码行数:7,代码来源:__init__.py

示例6: create_join_team

def create_join_team(hackathon_name, tid):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    team = Context.from_object(__get_api(API_TEAM, headers, params={"id": tid}))
    if team.get('error') is not None:
        return redirect('404')
    else:
        role = team.is_admin and 4 or 0
        role += team.is_leader and 2 or 0
        role += team.is_member and 1 or 0
        return render("/site/team.html", hackathon_name=hackathon_name, team=team, role=role)
开发者ID:ifhuang,项目名称:open-hackathon,代码行数:10,代码来源:__init__.py

示例7: workspace

def workspace(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session["token"]}
    reg = Context.from_object(__get_api(API_HACAKTHON_REGISTRATION, headers))

    if reg.get('registration') is not None:
        if reg.registration.status == 1 or (reg.registration.status == 3 and reg.hackathon.basic_info.auto_approve):
            return render("/site/workspace.html", hackathon_name=hackathon_name,
                          workspace=True,
                          hackathon=reg.get("hackathon"),
                          experiment=reg.get('experiment', {id: 0}))
        else:
            return redirect(url_for('hackathon', hackathon_name=hackathon_name))
    else:
        return redirect(url_for('hackathon', hackathon_name=hackathon_name))
开发者ID:mshubian,项目名称:open-hackathon,代码行数:14,代码来源:__init__.py

示例8: hackathon

def hackathon(hackathon_name):
    data = __get_api(API_HACKATHON, {"hackathon_name": hackathon_name, "token": session.get("token")})
    data = Context.from_object(data)

    if data.get("error") is not None or data.get("hackathon", data).status != 1:
        return render("/404.html")
    else:
        return render(
            "/site/hackathon.html",
            hackathon_name=hackathon_name,
            hackathon=data.get("hackathon", data),
            user=data.get("user"),
            registration=data.get("registration"),
            experiment=data.get("experiment"),
        )
开发者ID:xunxunzgq,项目名称:open-hackathon,代码行数:15,代码来源:__init__.py

示例9: workspace

def workspace(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    reg = Context.from_object(__get_api(API_HACKATHON_REGISTRATION, headers))

    if reg.get('registration') is not None:
        if reg.registration.status == 1 or reg.registration.status == 3:
            return render("/site/workspace.html", hackathon_name=hackathon_name,
                          workspace=True,
                          asset=reg.get("asset"),
                          hackathon=reg.get("hackathon"),
                          experiment=reg.get('experiment', {id: 0}))
        else:
            return redirect(url_for('hackathon', hackathon_name=hackathon_name))
    else:
        return redirect(url_for('hackathon', hackathon_name=hackathon_name))
开发者ID:lclchen,项目名称:open-hackathon,代码行数:15,代码来源:__init__.py

示例10: hackathon

def hackathon(hackathon_name):
    if current_user.is_authenticated():
        data = __get_api(API_HACAKTHON_REGISTRATION, {"hackathon_name": hackathon_name, "token": session["token"]})
    else:
        data = __get_api(API_HACKATHON, {"hackathon_name": hackathon_name})

    data = Context.from_object(data)

    if data.get('error') is not None or data.get('hackathon', data).status != 1:
        return render("/404.html")
    else:
        return render("/site/hackathon.html",
                      hackathon_name=hackathon_name,
                      hackathon=data.get("hackathon", data),
                      user=data.get("user"),
                      registration=data.get("registration"),
                      experiment=data.get("experiment"))
开发者ID:mshubian,项目名称:open-hackathon,代码行数:17,代码来源:__init__.py

示例11: create_join_team

def create_join_team(hackathon_name, tid):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    team = Context.from_object(__get_api(API_TEAM, headers, params={"id": tid}))
    return render_team_page(hackathon_name, team)
开发者ID:rapidhere,项目名称:open-hackathon,代码行数:4,代码来源:__init__.py

示例12: my_team

def my_team(hackathon_name):
    headers = {"hackathon_name": hackathon_name, "token": session.get("token")}
    team = Context.from_object(__get_api(API_MY_TEAM, headers))
    return render_team_page(hackathon_name, team)
开发者ID:rapidhere,项目名称:open-hackathon,代码行数:4,代码来源:__init__.py


注:本文中的client.Context类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。