示例#1
0
    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
示例#2
0
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_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'])
    else:
        raise ValueError('Unexpected object type: {}'.format(ref['type']))
示例#3
0
 def _process_args(self):
     RHDisplayEventBase._process_args(self)
     self.session = Session.get_or_404(request.view_args['session_id'],
                                       is_deleted=False)
示例#4
0
文件: __init__.py 项目: javfg/indico
 def _process_args(self):
     RHManageSessionsBase._process_args(self)
     self.session = Session.get_or_404(request.view_args['session_id'],
                                       is_deleted=False)