def store_gs_file(self, content_type, gs_filename, blob_file, filename):
    """Store a supplied form-data item to GS.

    Delegate all the work of gs file creation to CloudStorageStub.

    Args:
      content_type: The MIME content type of the uploaded file.
      gs_filename: The gs filename to create of format bucket/filename.
      blob_file: A file-like object containing the contents of the file.
      filename: user provided filename.

    Returns:
      datastore.Entity('__GsFileInfo__') associated with the upload.
    """
    gs_stub = cloudstorage_stub.CloudStorageStub(self._blob_storage)
    blobkey = gs_stub.post_start_creation('/' + gs_filename,
                                          {'content-type': content_type})
    content = blob_file.read()
    return gs_stub.put_continue_creation(
        blobkey, content, (0, len(content) - 1), len(content), filename)
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/blob_upload.py/Application.store_gs_file/original