本文整理汇总了Python中helpers.firebase.firebase_pusher.FirebasePusher.updateEvent方法的典型用法代码示例。如果您正苦于以下问题:Python FirebasePusher.updateEvent方法的具体用法?Python FirebasePusher.updateEvent怎么用?Python FirebasePusher.updateEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.firebase.firebase_pusher.FirebasePusher
的用法示例。
在下文中一共展示了FirebasePusher.updateEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updateEvent [as 别名]
def post(self):
self._require_admin()
event_key = self.request.get('event_key')
matches_csv = self.request.get('matches_csv')
matches = OffseasonMatchesParser.parse(matches_csv)
event = Event.get_by_id(event_key)
matches = [Match(
id=Match.renderKeyName(
event.key.id(),
match.get("comp_level", None),
match.get("set_number", 0),
match.get("match_number", 0)),
event=event.key,
game=Match.FRC_GAMES_BY_YEAR.get(event.year, "frc_unknown"),
set_number=match.get("set_number", 0),
match_number=match.get("match_number", 0),
comp_level=match.get("comp_level", None),
team_key_names=match.get("team_key_names", None),
alliances_json=match.get("alliances_json", None)
)
for match in matches]
new_matches = MatchManipulator.createOrUpdate(matches)
try:
last_matches = MatchHelper.recentMatches(new_matches, 1)
upcoming_matches = MatchHelper.upcomingMatches(new_matches, 8)
except:
logging.warning("Computing last/upcoming matches for Firebase failed!")
try:
FirebasePusher.updateEvent(event, last_matches, upcoming_matches)
except:
logging.warning("Enqueuing Firebase push failed!")
self.redirect('/admin/event/{}'.format(event_key))
示例2: get
# 需要导入模块: from helpers.firebase.firebase_pusher import FirebasePusher [as 别名]
# 或者: from helpers.firebase.firebase_pusher.FirebasePusher import updateEvent [as 别名]
def get(self, event_key):
df = DatafeedUsfirst()
event = Event.get_by_id(event_key)
new_matches = MatchManipulator.createOrUpdate(df.getMatches(event))
try:
last_matches = MatchHelper.recentMatches(new_matches, 1)
upcoming_matches = MatchHelper.upcomingMatches(new_matches, 8)
except:
logging.warning("Computing last/upcoming matches for Firebase failed!")
try:
FirebasePusher.updateEvent(event, last_matches, upcoming_matches)
except:
logging.warning("Enqueuing Firebase push failed!")
template_values = {
'matches': new_matches,
}
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_matches_get.html')
self.response.out.write(template.render(path, template_values))