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