def create_session(event, data): """Create a new session with the information passed in the `data` argument""" event_session = Session(event_new=event) event_session.populate_from_dict(data) db.session.flush() event.log(EventLogRealm.management, EventLogKind.positive, 'Sessions', 'Session "{}" has been created'.format(event_session.title), session.user) logger.info('Session %s created by %s', event_session, session.user) return event_session
def create_session(event, data): """ Create a new session with the information passed in the `data` argument. """ event_session = Session(event=event) event_session.populate_from_dict(data) db.session.flush() event.log(EventLogRealm.management, LogKind.positive, 'Sessions', f'Session "{event_session.title}" has been created', session.user, meta={'session_id': event_session.id}) logger.info('Session %s created by %s', event_session, session.user) return event_session
def _checkParams(self): data = request.json self.object = None if 'categId' in data: self.object = Category.get_one(data['categId']) elif 'contribId' in data: self.object = Contribution.get_one(data['contribId']) elif 'sessionId' in data: self.object = Session.get_one(data['sessionId']) elif 'confId' in data: self.object = Event.get_one(data['confId']) if self.object is None: raise BadRequest
def _process_args(self): data = request.json self.object = None if 'categId' in data: self.object = Category.get_or_404(data['categId']) elif 'contribId' in data: self.object = Contribution.get_or_404(data['contribId']) elif 'sessionId' in data: self.object = Session.get_or_404(data['sessionId']) elif 'eventId' in data: self.object = Event.get_or_404(data['eventId']) if self.object is None: raise BadRequest
def _process_args(self): data = request.json self.object = None if 'categId' in data: self.object = Category.get_one(data['categId']) elif 'contribId' in data: self.object = Contribution.get_one(data['contribId']) elif 'sessionId' in data: self.object = Session.get_one(data['sessionId']) elif 'confId' in data: self.object = Event.get_one(data['confId']) if self.object is None: raise BadRequest
def obj_deref(ref): """Returns the object identified by `ref`""" from indico_livesync.models.queue import EntryType if ref['type'] == EntryType.category: return Category.get_one(ref['category_id']) elif ref['type'] == EntryType.event: return Event.get_one(ref['event_id']) elif ref['type'] == EntryType.session: return Session.get_one(ref['session_id']) elif ref['type'] == EntryType.contribution: return Contribution.get_one(ref['contrib_id']) elif ref['type'] == EntryType.subcontribution: return SubContribution.get_one(ref['subcontrib_id']) else: raise ValueError('Unexpected object type: {}'.format(ref['type']))
def _migrate_session(self, old_session, friendly_id=None): ac = old_session._Session__ac code = convert_to_unicode(old_session._code) if code == 'no code': code = '' session = Session(event_new=self.event, title=convert_to_unicode(old_session.title), description=convert_to_unicode(old_session.description), is_poster=(old_session._ttType == 'poster'), code=code, default_contribution_duration=old_session._contributionDuration, protection_mode=PROTECTION_MODE_MAP[ac._accessProtection]) if friendly_id is not None: session.friendly_id = friendly_id else: # migrating a zombie session; we simply give it a new friendly id self.event._last_friendly_session_id += 1 session.friendly_id = self.event._last_friendly_session_id if not self.quiet: self.print_info('%[blue!]Session%[reset] {}'.format(session.title)) self.event_ns.legacy_session_map[old_session] = session if old_session.id not in self.legacy_session_ids_used: session.legacy_mapping = LegacySessionMapping(event_new=self.event, legacy_session_id=old_session.id) self.legacy_session_ids_used.add(old_session.id) else: self.print_warning('%[yellow!]Duplicate session id; not adding legacy mapping for {}' .format(old_session.id)) # colors try: session.colors = ColorTuple(old_session._textColor, old_session._color) except (AttributeError, ValueError) as e: self.print_warning('%[yellow]Session has no colors: "{}" [{}]'.format(session.title, e)) principals = {} # managers / read access self._process_ac(SessionPrincipal, principals, ac, allow_emails=True) # coordinators for submitter in old_session._coordinators.itervalues(): self._process_principal(SessionPrincipal, principals, submitter, 'Coordinator', roles={'coordinate'}) self._process_principal_emails(SessionPrincipal, principals, getattr(old_session, '_coordinatorsEmail', []), 'Coordinator', roles={'coordinate'}, allow_emails=True) session.acl_entries = set(principals.itervalues()) return session
def _process_args(self): RHManageSessionsBase._process_args(self) self.session = Session.get_one(request.view_args['session_id'], is_deleted=False)
def _checkParams(self, params): RHManageSessionsBase._checkParams(self, params) self.session = Session.get_one(request.view_args['session_id'], is_deleted=False)
def _create_session(event, title, duration): entry = Session(event=event, title=title) db.session.add(entry) db.session.flush() return entry
def _process_args(self): RHManageSessionsBase._process_args(self) self.session = Session.get_or_404(request.view_args['session_id'], is_deleted=False)
def _process_args(self): RHDisplayEventBase._process_args(self) self.session = Session.get_one(request.view_args['session_id'], is_deleted=False)
def _checkParams(self, params): RHConferenceBaseDisplay._checkParams(self, params) self.session = Session.get_one(request.view_args['session_id'], is_deleted=False)
def _process_args(self): RHDisplayEventBase._process_args(self) self.session = Session.get_or_404(request.view_args['session_id'], is_deleted=False)
def _process_args(self): RHConferenceBaseDisplay._process_args(self) self.session = Session.get_one(request.view_args['session_id'], is_deleted=False)