本文整理汇总了Python中helpers.award_manipulator.AwardManipulator.delete_keys方法的典型用法代码示例。如果您正苦于以下问题:Python AwardManipulator.delete_keys方法的具体用法?Python AwardManipulator.delete_keys怎么用?Python AwardManipulator.delete_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.award_manipulator.AwardManipulator
的用法示例。
在下文中一共展示了AwardManipulator.delete_keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process_request
# 需要导入模块: from helpers.award_manipulator import AwardManipulator [as 别名]
# 或者: from helpers.award_manipulator.AwardManipulator import delete_keys [as 别名]
def _process_request(self, request, event_key):
event = Event.get_by_id(event_key)
awards = []
for award in JSONAwardsParser.parse(request.body, event_key):
awards.append(Award(
id=Award.render_key_name(event.key_name, award['award_type_enum']),
name_str=award['name_str'],
award_type_enum=award['award_type_enum'],
year=event.year,
event=event.key,
event_type_enum=event.event_type_enum,
team_list=[ndb.Key(Team, team_key) for team_key in award['team_key_list']],
recipient_json_list=award['recipient_json_list']
))
# it's easier to clear all awards and add new ones than try to find the difference
old_award_keys = Award.query(Award.event == event.key).fetch(None, keys_only=True)
AwardManipulator.delete_keys(old_award_keys)
if event.remap_teams:
EventHelper.remapteams_awards(awards, event.remap_teams)
AwardManipulator.createOrUpdate(awards)
self.response.out.write(json.dumps({'Success': "Awards successfully updated"}))