Exemple #1
0
  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()
Exemple #2
0
  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()
Exemple #3
0
    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()
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)
Exemple #5
0
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)
  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()
Exemple #7
0
    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()
Exemple #8
0
  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
Exemple #9
0
 def getGSoC2011Proposal(link_id, id):
   profile = getGSoC2011Profile(link_id)
   return GSoCProposal.get_by_id(id, profile)
Exemple #10
0
 def getGSoC2012Proposal(link_id, id):
   profile = getGSoC2012Profile(link_id)
   return GSoCProposal.get_by_id(id, profile)
Exemple #11
0
 def proposalFromKwargs(self):
     id = int(self.data.kwargs['id'])
     self.data.proposal = GSoCProposal.get_by_id(id,
                                                 parent=self.data.profile)
Exemple #12
0
 def proposalFromKwargs(self):
   id = int(self.data.kwargs['id'])
   self.data.proposal = GSoCProposal.get_by_id(id, parent=self.data.profile)