本文整理汇总了Python中indico.modules.vc.models.vc_rooms.VCRoomEventAssociation.data方法的典型用法代码示例。如果您正苦于以下问题:Python VCRoomEventAssociation.data方法的具体用法?Python VCRoomEventAssociation.data怎么用?Python VCRoomEventAssociation.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.vc.models.vc_rooms.VCRoomEventAssociation
的用法示例。
在下文中一共展示了VCRoomEventAssociation.data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: migrate_event_booking
# 需要导入模块: from indico.modules.vc.models.vc_rooms import VCRoomEventAssociation [as 别名]
# 或者: from indico.modules.vc.models.vc_rooms.VCRoomEventAssociation import data [as 别名]
def migrate_event_booking(self, vc_room, booking):
ch_idx = self.zodb_root['conferences']
booking_params = booking._bookingParams
old_link_type = getattr(booking, '_linkVideoType', None)
link_type = (VCRoomLinkType.get(MAP_LINK_TYPES[booking._linkVideoType]) if old_link_type
else VCRoomLinkType.event)
if booking._conf.id not in ch_idx:
print cformat(
"[%{red!}WARNING%{reset}] %{yellow!}{} is linked to event '{}' but the latter seems to have been"
" deleted. Removing link."
).format(vc_room, booking._conf.id)
return
if link_type == VCRoomLinkType.event:
extracted_id = None
elif not booking._linkVideoId:
print cformat(
"[%{red!}WARNING%{reset}] %{yellow!}{} is linked to a {} but no id given%{reset}. Linking to event."
).format(vc_room, link_type.name)
extracted_id = None
link_type = VCRoomLinkType.event
else:
extracted_id = extract_id(booking._linkVideoId)
if link_type != VCRoomLinkType.event and not is_valid_link(booking._conf, link_type, extracted_id):
print cformat(
"[%{red!}WARNING%{reset}] %{yellow!}{} is linked to a {} but it does not exist%{reset}. "
"Linking to event."
).format(vc_room, link_type.name)
link_type = VCRoomLinkType.event
extracted_id = None
event_vc_room = VCRoomEventAssociation(
event_id=booking._conf.id,
vc_room=vc_room,
link_type=link_type,
link_id=extracted_id,
show=not booking._hidden
)
event_vc_room.data = {
'show_pin': booking_params['displayPin'],
'show_phone_numbers': booking_params.get('displayPhoneNumbers', True),
'show_autojoin': booking_params['displayURL'],
}
db.session.add(event_vc_room)
print cformat('%{green}<->%{reset} %{cyan!}{}%{reset} %{red!}{}%{reset} [%{yellow}{}%{reset}]').format(
booking._conf.id, booking._roomId, old_link_type)