def get(self):
    """GET Handler.

    With no parameters, return the URL to use to submit uploads via
    multipart/form-data.

    With mode and key parameters, return status of the previous uploadpkg
    operation to the calling client.

    This method actually acts as a helper to the starting and finishing
    of the uploadpkg post() method.

    Parameters:
      mode: optionally, 'success' or 'error'
      key: optionally, blobstore key that was uploaded
    """
    if not handlers.IsHttps(self):
      # TODO(user): Does blobstore support https yet? If so, we can
      # enforce security in app.yaml and not do this check here.
      return

    if not auth.HasPermission(auth.UPLOAD):
      self.error(403)
      return

    mode = self.request.get('mode')
    msg = self.request.get('msg', None)
    if mode == 'success':
      filename = self.request.get('filename')
      msg = '%s successfully uploaded and is ready for deployment.' % filename
      self.redirect('/admin/package/%s?msg=%s' % (filename, msg))
    elif mode == 'error':
      self.response.set_status(400)
      self.response.out.write(msg)
    else:
      filename = self.request.get('filename')
      if not filename:
        self.response.set_status(404)
        self.response.out.write('Filename required')
        return

      p = models.PackageInfo.get_by_key_name(filename)
      if not p:
        self.response.set_status(400)
        self.response.out.write(
            'You must first upload a pkginfo for %s' % filename)
        return
      elif p.blob_info:
        self.response.set_status(400)
        self.response.out.write('This file already exists.')
        return

      values = {
          'upload_url': blobstore.create_upload_url(
              '/admin/uploadpkg', gs_bucket_name=util.GetBlobstoreGSBucket()),
          'filename': filename,
          'file_size_kbytes': p.plist['installer_item_size'],
      }
      self.Render('upload_pkg_form.html', values)
dataset/ETHPy150Open google/simian/src/simian/mac/admin/uploadpkg.py/UploadPackage.get/original