Пример #1
0
    def get(self, data, check, mutator):
        if self._tax(data):
            blob_key = self._profile(data).student_data.tax_form
        else:
            blob_key = self._profile(data).student_data.enrollment_form

        return bs_helper.sendBlob(blobstore.BlobInfo(blob_key))
Пример #2
0
  def get(self):
    if self._tax():
      blob_info = str(self._studentInfo().tax_form)
    else:
      blob_info = str(self._studentInfo().enrollment_form)

    self.response = bs_helper.sendBlob(blob_info)
Пример #3
0
  def get(self, data, check, mutator):
    if self._tax(data):
      blob_key = self._profile(data).student_data.tax_form
    else:
      blob_key = self._profile(data).student_data.enrollment_form

    return bs_helper.sendBlob(blobstore.BlobInfo(blob_key))
Пример #4
0
  def get(self, data, check, mutator):
    """Allows public to download the content anonymously."""
    content_id = data.kwargs.get('content_id')
    if not content_id:
      raise exception.NotFound(message=DEF_CONTENT_NOT_FOUND)

    q = static_content.StaticContent.all()
    q.ancestor(data.program)
    q.filter('content_id', content_id)
    entity = q.get()
    if not entity:
      raise exception.NotFound(message=DEF_CONTENT_NOT_FOUND)

    return bs_helper.sendBlob(entity.content)
Пример #5
0
    def get(self, data, check, mutator):
        """Allows hosts to download the student forms."""
        if url_names.CONSENT_FORM_GET_PARAM in data.GET:
            download = data.url_ndb_profile.student_data.consent_form
        elif url_names.ENROLLMENT_FORM_GET_PARAM in data.GET:
            download = data.url_ndb_profile.student_data.enrollment_form
        else:
            raise exception.BadRequest(message='No file requested')

        # download has been requested
        if download:
            return bs_helper.sendBlob(blobstore.BlobInfo(download))
        else:
            raise exception.NotFound(message='File not found')
Пример #6
0
    def get(self, data, check, mutator):
        """Allows public to download the content anonymously."""
        content_id = data.kwargs.get('content_id')
        if not content_id:
            raise exception.NotFound(message=DEF_CONTENT_NOT_FOUND)

        q = static_content.StaticContent.all()
        q.ancestor(data.program)
        q.filter('content_id', content_id)
        entity = q.get()
        if not entity:
            raise exception.NotFound(message=DEF_CONTENT_NOT_FOUND)

        return bs_helper.sendBlob(entity.content)
Пример #7
0
  def get(self, data, check, mutator):
    """Allows hosts to download the student forms."""
    if url_names.CONSENT_FORM_GET_PARAM in data.GET:
      download = data.url_ndb_profile.student_data.consent_form
    elif url_names.ENROLLMENT_FORM_GET_PARAM in data.GET:
      download = data.url_ndb_profile.student_data.enrollment_form
    else:
      raise exception.BadRequest(message='No file requested')

    # download has been requested
    if download:
      return bs_helper.sendBlob(blobstore.BlobInfo(download))
    else:
      raise exception.NotFound(message='File not found')
Пример #8
0
  def get(self, data, check, mutator):
    """Attempts to download the blob in the worksubmission that is specified
    in the GET argument.
    """
    id_string = data.request.GET.get('id', '')
    submission_id = int(id_string) if id_string.isdigit() else -1

    work = work_submission_model.GCIWorkSubmission.get_by_id(
        submission_id, data.task)

    if work and work.upload_of_work:
      return bs_helper.sendBlob(work.upload_of_work)
    else:
      raise exception.BadRequest(message=DEF_NO_WORK_FOUND % id_string)
Пример #9
0
  def get(self):
    """Attempts to download the blob in the worksubmission that is specified
    in the GET argument.
    """
    id_s = self.request.GET.get('id', '')
    id = int(id_s) if id_s.isdigit() else -1

    work = GCIWorkSubmission.get_by_id(id, self.data.task)

    if not work or not work.upload_of_work:
      return self.error(400, DEF_NO_WORK_FOUND %id)

    upload = work.upload_of_work
    self.response = bs_helper.sendBlob(upload)
Пример #10
0
    def get(self, data, check, mutator):
        """Attempts to download the blob in the worksubmission that is specified
    in the GET argument.
    """
        id_string = data.request.GET.get('id', '')
        submission_id = int(id_string) if id_string.isdigit() else -1

        work = work_submission_model.GCIWorkSubmission.get_by_id(
            submission_id, data.task)

        if work and work.upload_of_work:
            return bs_helper.sendBlob(work.upload_of_work)
        else:
            raise exception.BadRequest(message=DEF_NO_WORK_FOUND % id_string)
Пример #11
0
  def get(self, data, check, mutator):
    """Handles download of the forms otherwise resumes normal rendering."""
    if 'consent_form' not in data.GET and 'enrollment_form' not in data.GET:
      # no download request has been specified
      return super(StudentFormUpload, self).get(data, check, mutator)
    elif 'consent_form' in data.GET:
      download = data.ndb_profile.student_data.consent_form
    elif 'enrollment_form' in data.GET:
      download = data.ndb_profile.student_data.enrollment_form

    # download has been requested
    if download:
      return bs_helper.sendBlob(blobstore.BlobInfo(download))
    else:
      raise exception.NotFound(message='File not found')
Пример #12
0
    def get(self, data, check, mutator):
        """Handles download of the forms otherwise resumes normal rendering."""
        if 'consent_form' not in data.GET and 'enrollment_form' not in data.GET:
            # no download request has been specified
            return super(StudentFormUpload, self).get(data, check, mutator)
        elif 'consent_form' in data.GET:
            download = data.ndb_profile.student_data.consent_form
        elif 'enrollment_form' in data.GET:
            download = data.ndb_profile.student_data.enrollment_form

        # download has been requested
        if download:
            return bs_helper.sendBlob(blobstore.BlobInfo(download))
        else:
            raise exception.NotFound(message='File not found')
Пример #13
0
  def get(self):
    """Handles download of the forms otherwise resumes normal rendering.
    """
    if 'consent_form' in self.data.GET:
      download = self.data.student_info.consent_form
    elif 'student_id_form' in self.data.GET:
      download = self.data.student_info.student_id_form
    else:
      return super(StudentFormUpload, self).get()

    # download has been requested
    if not download:
      self.error(httplib.NOT_FOUND, 'File not found')

    self.response = bs_helper.sendBlob(download)
Пример #14
0
  def get(self):
    """Allows hosts to download the student forms.
    """
    download = None
    if url_names.CONSENT_FORM_GET_PARAM in self.data.GET:
      download = self.data.url_student_info.consent_form
    elif url_names.STUDENT_ID_FORM_GET_PARAM in self.data.GET:
      download = self.data.url_student_info.student_id_form
    else:
      raise BadRequest('No file requested')

    # download has been requested
    if not download:
      self.error(httplib.NOT_FOUND, 'File not found')

    self.response = bs_helper.sendBlob(download)
Пример #15
0
  def get(self, data, check, mutator):
    """Get handler for the code sample download file."""
    assert isSet(data.url_project)

    try:
      id_value = int(data.request.GET['id'])
      code_sample = GSoCCodeSample.get_by_id(id_value, data.url_project)
      if not code_sample or not code_sample.upload_of_work:
        raise exception.BadRequest(
            message='Requested project or code sample not found')
      else:
        return bs_helper.sendBlob(code_sample.upload_of_work)
    except KeyError:
      raise exception.BadRequest(message='id argument missing in GET data')
    except ValueError:
      raise exception.BadRequest(
          message='id argument in GET data is not a number')
Пример #16
0
    def get(self, data, check, mutator):
        """Get handler for the code sample download file."""
        assert isSet(data.url_project)

        try:
            id_value = int(data.request.GET['id'])
            code_sample = GSoCCodeSample.get_by_id(id_value, data.url_project)
            if not code_sample or not code_sample.upload_of_work:
                raise exception.BadRequest(
                    message='Requested project or code sample not found')
            else:
                return bs_helper.sendBlob(code_sample.upload_of_work)
        except KeyError:
            raise exception.BadRequest(
                message='id argument missing in GET data')
        except ValueError:
            raise exception.BadRequest(
                message='id argument in GET data is not a number')
Пример #17
0
 def get(self, data, check, mutator):
     """See base.GSoCRequestHandler.get for specification."""
     return bs_helper.sendBlob(data.program.schools)
Пример #18
0
 def get(self, data, check, mutator):
   """See base.GSoCRequestHandler.get for specification."""
   return bs_helper.sendBlob(data.program.schools)