def obj_deref(ref): """Return the object identified by `ref`.""" from indico_livesync.models.queue import EntryType if ref['type'] == EntryType.category: return Category.get_or_404(ref['category_id']) elif ref['type'] == EntryType.event: return Event.get_or_404(ref['event_id']) elif ref['type'] == EntryType.session: return Session.get_or_404(ref['session_id']) elif ref['type'] == EntryType.contribution: return Contribution.get_or_404(ref['contrib_id']) elif ref['type'] == EntryType.subcontribution: return SubContribution.get_or_404(ref['subcontrib_id']) elif ref['type'] == EntryType.note: return EventNote.get_or_404(ref['note_id']) elif ref['type'] == EntryType.attachment: return Attachment.get_or_404(ref['attachment_id']) else: raise ValueError('Unexpected object type: {}'.format(ref['type']))
def _process(self): note = EventNote.get_or_404(request.view_args['note_id']) if embed_url := self._get_embed_url(note): return redirect(embed_url)