本文整理汇总了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)