本文整理匯總了Python中indico.modules.events.contributions.models.contributions.Contribution.get_one方法的典型用法代碼示例。如果您正苦於以下問題:Python Contribution.get_one方法的具體用法?Python Contribution.get_one怎麽用?Python Contribution.get_one使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類indico.modules.events.contributions.models.contributions.Contribution
的用法示例。
在下文中一共展示了Contribution.get_one方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _process_args
# 需要導入模塊: from indico.modules.events.contributions.models.contributions import Contribution [as 別名]
# 或者: from indico.modules.events.contributions.models.contributions.Contribution import get_one [as 別名]
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
示例2: obj_deref
# 需要導入模塊: from indico.modules.events.contributions.models.contributions import Contribution [as 別名]
# 或者: from indico.modules.events.contributions.models.contributions.Contribution import get_one [as 別名]
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']))
示例3: _process_args
# 需要導入模塊: from indico.modules.events.contributions.models.contributions import Contribution [as 別名]
# 或者: from indico.modules.events.contributions.models.contributions.Contribution import get_one [as 別名]
def _process_args(self):
RHPapersBase._process_args(self)
self.contribution = Contribution.get_one(request.view_args['contrib_id'], is_deleted=False)
self.paper = self.contribution.paper
if self.paper is None and self.PAPER_REQUIRED:
raise NotFound
示例4: _process_args
# 需要導入模塊: from indico.modules.events.contributions.models.contributions import Contribution [as 別名]
# 或者: from indico.modules.events.contributions.models.contributions.Contribution import get_one [as 別名]
def _process_args(self):
RHDisplayEventBase._process_args(self)
self.contrib = Contribution.get_one(request.view_args['contrib_id'], is_deleted=False)