本文整理汇总了Python中soc.modules.gsoc.models.proposal.GSoCProposal.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProposal.get_by_id方法的具体用法?Python GSoCProposal.get_by_id怎么用?Python GSoCProposal.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soc.modules.gsoc.models.proposal.GSoCProposal
的用法示例。
在下文中一共展示了GSoCProposal.get_by_id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: proposalFromKwargs
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def proposalFromKwargs(self):
self.profileFromKwargs()
assert access_checker.isSet(self.data.url_profile)
# can safely call int, since regexp guarnatees a number
proposal_id = int(self.data.kwargs['id'])
if not proposal_id:
raise NotFound('Proposal id must be a positive number')
self.data.proposal = GSoCProposal.get_by_id(
proposal_id, parent=self.data.url_profile)
if not self.data.proposal:
raise NotFound('Requested proposal does not exist')
org_key = GSoCProposal.org.get_value_for_datastore(self.data.proposal)
self.data.proposal_org = self.data.getOrganization(org_key)
parent_key = self.data.proposal.parent_key()
if self.data.profile and parent_key == self.data.profile.key():
self.data.proposer = self.data.profile
else:
self.data.proposer = self.data.proposal.parent()
示例2: checkAccess
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def checkAccess(self):
self.check.isLoggedIn()
self.check.isActiveStudent()
self.data.proposal = GSoCProposal.get_by_id(
int(self.data.kwargs['id']), parent=self.data.profile)
self.check.canStudentUpdateProposal()
示例3: getProposalFromKwargs
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def getProposalFromKwargs(kwargs):
fields = ['sponsor', 'program', 'student']
key_name = '/'.join(kwargs[i] for i in fields)
parent = db.Key.from_path('User', kwargs['student'],
'GSoCProfile', key_name)
if not kwargs['id'].isdigit():
raise BadRequest("Proposal id is not numeric")
id = int(kwargs['id'])
return GSoCProposal.get_by_id(id, parent=parent)
示例4: checkAccess
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def checkAccess(self):
self.data.proposer_user = User.get_by_key_name(self.data.kwargs['student'])
fields = ['sponsor', 'program', 'student']
key_name = '/'.join(self.data.kwargs[i] for i in fields)
self.data.proposer_profile = GSoCProfile.get_by_key_name(
key_name, parent=self.data.proposer_user)
if not self.data.proposer_profile:
raise NotFound('Requested user does not exist')
self.data.proposal = GSoCProposal.get_by_id(
int(self.data.kwargs['id']),
parent=self.data.proposer_profile)
if not self.data.proposal:
raise NotFound('Requested proposal does not exist')
self.data.proposal_org = self.data.proposal.org
self.check.canAccessProposalEntity()
self.mutator.commentVisible()
示例5: checkAccess
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def checkAccess(self):
self.check.isLoggedIn()
self.check.isActiveStudent()
self.data.proposal = GSoCProposal.get_by_id(
int(self.data.kwargs['id']), parent=self.data.profile)
self.data.organization = self.data.proposal.org
self.check.canStudentUpdateProposal()
if self.data.POST:
action = self.data.POST['action']
status = self.data.proposal.status
if status == 'pending' and action == self.ACTIONS['resubmit']:
error_msg = ugettext('You cannot resubmit a pending proposal')
raise AccessViolation(error_msg)
if status == 'withdrawn' and action == self.ACTIONS['withdraw']:
error_msg = ugettext('This proposal has already been withdrawn')
raise AccessViolation(error_msg)
if status == 'withdrawn' and action == self.ACTIONS['update']:
error_msg = ugettext('This proposal has been withdrawn')
raise AccessViolation(error_msg)
self.data.action = action
示例6: getGSoC2011Proposal
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def getGSoC2011Proposal(link_id, id):
profile = getGSoC2011Profile(link_id)
return GSoCProposal.get_by_id(id, profile)
示例7: proposalFromKwargs
# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import get_by_id [as 别名]
def proposalFromKwargs(self):
id = int(self.data.kwargs['id'])
self.data.proposal = GSoCProposal.get_by_id(id, parent=self.data.profile)