本文整理汇总了Python中models.event.Event.speaker_names方法的典型用法代码示例。如果您正苦于以下问题:Python Event.speaker_names方法的具体用法?Python Event.speaker_names怎么用?Python Event.speaker_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.event.Event
的用法示例。
在下文中一共展示了Event.speaker_names方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import speaker_names [as 别名]
def run(self):
app.logger.info("Updating schedule")
resp = requests.get(url=app.config['SCHEDULE_URL'])
schedule_json = json.loads(resp.text);
for event_data in schedule_json['conference_events']['events']:
event = db.session.query(Event).filter_by(id=event_data['id']).first()
if event:
event_does_not_exist_yet = False
event.title = event_data['title']
event.type = event_data['type']
else:
event_does_not_exist_yet = True
event = Event(event_data['id'], event_data['title'], event_data['type'])
event.abstract = event_data['abstract']
if 'room' in event_data:
#TODO: notify on talk ID changing
event.location_name = event_data['room']['name']
event.location_id = event_data['room']['id']
else:
event.location_name = None
event.location_id = None
if 'start_time' in event_data:
#TODO: notify on talk time changing
event.start_time = datetime.datetime.strptime(event_data['start_time'], "%Y-%m-%dT%H:%M:%SZ")
event.end_time = datetime.datetime.strptime(event_data['end_time'], "%Y-%m-%dT%H:%M:%SZ")
else:
event.start_time = None
event.end_time = None
speaker_names = []
for speaker in event_data['speakers']:
speaker_names.append(speaker['full_public_name'])
event.speaker_names = ", ".join(speaker_names)
if event_does_not_exist_yet:
db.session.add(event)
db.session.commit()
app.logger.info("All done")