本文整理汇总了Python中coprs.logic.complex_logic.ComplexLogic.get_copr_by_id_safe方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexLogic.get_copr_by_id_safe方法的具体用法?Python ComplexLogic.get_copr_by_id_safe怎么用?Python ComplexLogic.get_copr_by_id_safe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.complex_logic.ComplexLogic
的用法示例。
在下文中一共展示了ComplexLogic.get_copr_by_id_safe方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: webhooks_hello
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_by_id_safe [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
示例2: copr_createrepo
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_by_id_safe [as 别名]
def copr_createrepo(copr_id):
copr = ComplexLogic.get_copr_by_id_safe(copr_id)
chroots = [c.name for c in copr.active_chroots]
actions_logic.ActionsLogic.send_createrepo(
username=('@'+copr.group.name if copr.is_a_group_project else copr.user.name), coprname=copr.name,
chroots=chroots)
db.session.commit()
flask.flash("Repository metadata will be regenerated in a few minutes ...")
return flask.redirect(url_for_copr_details(copr))
示例3: webhooks_hello
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_by_id_safe [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