本文整理汇总了Python中dao.Dao.set_match_exclusion_by_tournament_id_and_match_id方法的典型用法代码示例。如果您正苦于以下问题:Python Dao.set_match_exclusion_by_tournament_id_and_match_id方法的具体用法?Python Dao.set_match_exclusion_by_tournament_id_and_match_id怎么用?Python Dao.set_match_exclusion_by_tournament_id_and_match_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dao.Dao
的用法示例。
在下文中一共展示了Dao.set_match_exclusion_by_tournament_id_and_match_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import set_match_exclusion_by_tournament_id_and_match_id [as 别名]
def post(self, region, id):
dao = Dao(region, mongo_client=mongo_client)
user = get_user_from_request(request, dao)
args = tournament_details_exclude_match_parser.parse_args()
try:
tournament = dao.get_tournament_by_id(ObjectId(id))
except:
return "Casting error", 400
if not user:
return 'Permission denied', 403
if not is_user_admin_for_regions(user, tournament.regions):
return 'Permission denied', 403
match_id = int(args['match_id'])
excluded = (args['excluded_tf'].lower() == 'true')
try:
dao.set_match_exclusion_by_tournament_id_and_match_id(ObjectId(id), match_id, excluded)
except Exception as e:
print e
return 'Match exclusion failed', 400