本文整理汇总了Python中indico.modules.vc.models.vc_rooms.VCRoomEventAssociation类的典型用法代码示例。如果您正苦于以下问题:Python VCRoomEventAssociation类的具体用法?Python VCRoomEventAssociation怎么用?Python VCRoomEventAssociation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VCRoomEventAssociation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clone
def clone(self, new_event, options):
if 'vc_rooms' not in options:
return
for old_event_vc_room in VCRoomEventAssociation.find_for_event(self.event, include_hidden=True):
event_vc_room = VCRoomEventAssociation(event_id=int(new_event.id),
link_type=old_event_vc_room.link_type,
link_id=old_event_vc_room.link_id,
show=old_event_vc_room.show,
data=old_event_vc_room.data)
if event_vc_room.link_object is not None:
event_vc_room.vc_room = old_event_vc_room.vc_room
db.session.add(event_vc_room)
示例2: migrate_event_booking
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)
示例3: process_vc_room_association
def process_vc_room_association(plugin, event, vc_room, form, event_vc_room=None, allow_same_room=False):
# disable autoflush, so that the new event_vc_room does not influence the result
with db.session.no_autoflush:
if event_vc_room is None:
event_vc_room = VCRoomEventAssociation()
plugin.update_data_association(event, vc_room, event_vc_room, form.data)
existing = set()
if event_vc_room.link_object is not None:
# check whether there is a room-event association already present
# for the given event, room and plugin
q = VCRoomEventAssociation.find(
VCRoomEventAssociation.event_new == event,
VCRoomEventAssociation.link_object == event_vc_room.link_object,
_join=VCRoom
)
if allow_same_room:
q = q.filter(VCRoom.id != vc_room.id)
existing = {x.vc_room for x in q}
if event_vc_room.link_type != VCRoomLinkType.event and existing:
transaction.abort()
flash(_("There is already a VC room attached to '{link_object_title}'.").format(
link_object_title=resolve_title(event_vc_room.link_object)), 'error')
return None
elif event_vc_room.link_type == VCRoomLinkType.event and vc_room in existing:
transaction.abort()
flash(_("This {plugin_name} room is already attached to the event.").format(plugin_name=plugin.friendly_name),
'error')
return None
else:
return event_vc_room
示例4: _contrib_deleted
def _contrib_deleted(contrib, **kwargs):
event = contrib.getConference()
if not event.id.isdigit():
return
for event_vc_room in VCRoomEventAssociation.find_for_event(event, include_hidden=True, include_deleted=True):
if event_vc_room.link_object is None:
event_vc_room.link_type = VCRoomLinkType.event
event_vc_room.link_id = None
示例5: _session_slot_deleted
def _session_slot_deleted(session_slot, **kwargs):
event = session_slot.getConference()
if event.has_legacy_id:
return
for event_vc_room in VCRoomEventAssociation.find_for_event(event, include_hidden=True, include_deleted=True):
if event_vc_room.link_object is None:
event_vc_room.link_type = VCRoomLinkType.event
event_vc_room.link_id = None
示例6: _process
def _process(self):
try:
room_event_assocs = VCRoomEventAssociation.find_for_event(self._conf, include_hidden=True,
include_deleted=True).all()
except ValueError:
raise IndicoError(_('This page is not available for legacy events.'))
event_vc_rooms = [event_vc_room for event_vc_room in room_event_assocs if event_vc_room.vc_room.plugin]
return WPVCManageEvent.render_template('manage_event.html', self._conf, event=self._conf,
event_vc_rooms=event_vc_rooms, plugins=get_vc_plugins().values())
示例7: _process
def _process(self):
event_vc_rooms = VCRoomEventAssociation.find_for_event(self.event_new).all()
vc_plugins_available = bool(get_vc_plugins())
linked_to = defaultdict(lambda: defaultdict(list))
for event_vc_room in event_vc_rooms:
if event_vc_room.vc_room.plugin:
linked_to[event_vc_room.link_type.name][event_vc_room.link_object].append(event_vc_room)
return WPVCEventPage.render_template('event_vc.html', self._conf, event=self.event_new,
event_vc_rooms=event_vc_rooms, linked_to=linked_to,
vc_plugins_available=vc_plugins_available)
示例8: _process
def _process(self):
room_event_assocs = VCRoomEventAssociation.find_for_event(
self.event_new, include_hidden=True, include_deleted=True
).all()
event_vc_rooms = [event_vc_room for event_vc_room in room_event_assocs if event_vc_room.vc_room.plugin]
return WPVCManageEvent.render_template(
"manage_event.html",
self._conf,
event=self.event_new,
event_vc_rooms=event_vc_rooms,
plugins=get_vc_plugins().values(),
)
示例9: find_event_vc_rooms
def find_event_vc_rooms(from_dt=None, to_dt=None, distinct=False):
"""Finds VC rooms matching certain criteria
:param from_dt: earliest event/contribution to include
:param to_dt: latest event/contribution to include
:param distinct: if True, never return the same ``(event, vcroom)``
more than once (even if it's linked more than once to
that event)
"""
from indico.modules.vc.models.vc_rooms import VCRoomEventAssociation
query = VCRoomEventAssociation.find()
if distinct:
query = query.distinct(VCRoomEventAssociation.event_id, VCRoomEventAssociation.vc_room_id)
if from_dt is not None or to_dt is not None:
query = query.join(IndexedEvent, IndexedEvent.id == VCRoomEventAssociation.event_id)
if from_dt is not None:
query = query.filter(IndexedEvent.start_date >= from_dt)
if to_dt is not None:
query = query.filter(IndexedEvent.start_date < to_dt)
for vc_room in query:
yield vc_room
示例10: _checkParams
def _checkParams(self):
self.event_vc_room = VCRoomEventAssociation.get_one(request.view_args['event_vc_room_id'])
self.vc_room = self.event_vc_room.vc_room
示例11: _visible
def _visible(event):
if event.has_legacy_id:
return False
return bool(get_vc_plugins()) and bool(VCRoomEventAssociation.find_for_event(event).count())
示例12: _event_deleted
def _event_deleted(event, **kwargs):
user = session.user if has_request_context() and session.user else User.get_system_user()
for event_vc_room in VCRoomEventAssociation.find_for_event(event, include_hidden=True, include_deleted=True):
event_vc_room.delete(user)
示例13: _inject_vc_room_action_buttons
def _inject_vc_room_action_buttons(event, item, **kwargs):
event_vc_room = VCRoomEventAssociation.get_linked_for_event(event).get(item)
if event_vc_room and event_vc_room.vc_room.plugin:
plugin = event_vc_room.vc_room.plugin
name = get_overridable_template_name('vc_room_timetable_buttons.html', plugin, core_prefix='vc/')
return render_template(name, event=event, event_vc_room=event_vc_room, **kwargs)
示例14: _event_deleted
def _event_deleted(event, **kwargs):
if not event.id.isdigit():
return
for event_vc_room in VCRoomEventAssociation.find_for_event(event, include_hidden=True, include_deleted=True):
event_vc_room.delete(_get_user())
示例15: _inject_vc_room_action_buttons
def _inject_vc_room_action_buttons(event, item, **kwargs):
event_vc_room = VCRoomEventAssociation.get_linked_for_event(event).get(item)
if event_vc_room and event_vc_room.vc_room.plugin:
return render_plugin_template('{}:vc_room_timetable_buttons.html'.format(event_vc_room.vc_room.plugin.name),
event=event, event_vc_room=event_vc_room, **kwargs)