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


Python PackagesLogic.get_for_webhook_rebuild方法代码示例

本文整理汇总了Python中coprs.logic.packages_logic.PackagesLogic.get_for_webhook_rebuild方法的典型用法代码示例。如果您正苦于以下问题:Python PackagesLogic.get_for_webhook_rebuild方法的具体用法?Python PackagesLogic.get_for_webhook_rebuild怎么用?Python PackagesLogic.get_for_webhook_rebuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coprs.logic.packages_logic.PackagesLogic的用法示例。


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

示例1: webhooks_hello

# 需要导入模块: from coprs.logic.packages_logic import PackagesLogic [as 别名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import get_for_webhook_rebuild [as 别名]
def webhooks_hello(copr_id, uuid):
    # For the documentation of the data we receive see:
    # https://developer.github.com/v3/activity/events/types/#pushevent
    try:
        copr = ComplexLogic.get_copr_by_id_safe(copr_id)
    except ObjectNotFound:
        return page_not_found("Project does not exist")

    if copr.webhook_secret != uuid:
        return access_restricted("This webhook is not valid")

    try:
        request_json = flask.request.json
        clone_url = request_json["repository"]["clone_url"]
    except KeyError:
        return "Bad Request", 400
    if "commits" in request_json:
        commits = request_json["commits"]
    else:
        commits = []

    packages = PackagesLogic.get_for_webhook_rebuild(copr_id, uuid, clone_url, commits)

    for package in packages:
        BuildsLogic.rebuild_package(package)

    db.session.commit()

    return "OK", 200
开发者ID:0-T-0,项目名称:copr,代码行数:31,代码来源:webhooks_general.py

示例2: webhooks_hello

# 需要导入模块: from coprs.logic.packages_logic import PackagesLogic [as 别名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import get_for_webhook_rebuild [as 别名]
def webhooks_hello(copr_id, uuid):
    try:
        copr = ComplexLogic.get_copr_by_id_safe(copr_id)
    except ObjectNotFound:
        return page_not_found("Project does not exist")

    if copr.webhook_secret != uuid:
        return access_restricted("This webhook is not valid")

    try:
        request_json = flask.request.json
        clone_url = request_json["repository"]["clone_url"]
    except KeyError:
        return "Bad Request", 400

    packages = PackagesLogic.get_for_webhook_rebuild(copr_id, uuid, clone_url)

    for package in packages:
        BuildsLogic.rebuild_package(package)

    db.session.commit()

    return "OK", 200
开发者ID:danvratil,项目名称:copr,代码行数:25,代码来源:webhooks_general.py


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