@db.non_transactional
  def put_continue_creation(self, token, content, content_range,
                            length=None,
                            _upload_filename=None):
    """Continue object upload with PUTs.

    This implements the resumable upload XML API.

    Args:
      token: upload token returned by post_start_creation.
      content: object content. None if no content was provided with this
        PUT request.
      content_range: a (start, end) tuple specifying the content range of this
        chunk. Both are inclusive according to XML API. None is content is None.
      length: file length, if this is the last chunk of file content.
      _upload_filename: internal use. Might be removed any time! This is
        used by blobstore to pass in the upload filename from user.

    Returns:
      _AE_GCSFileInfo entity for this file if the file is finalized.

    Raises:
      ValueError: if something is invalid. The exception.args is a tuple of
      (msg, http status code).
    """


    ns = namespace_manager.get_namespace()
    try:
      namespace_manager.set_namespace('')
      gcs_file = _AE_GCSFileInfo_.get_by_key_name(token)
      if not gcs_file:
        raise ValueError('Invalid token', httplib.BAD_REQUEST)
      if gcs_file.next_offset == -1:
        raise ValueError('Received more uploads after file %s '
                         'was finalized.' % gcs_file.filename,
                         httplib.OK)
      if content:
        start, end = content_range
        if len(content) != (end - start + 1):
          raise ValueError('Invalid content range %d-%d' % content_range,
                           httplib.REQUESTED_RANGE_NOT_SATISFIABLE)

        if start > gcs_file.next_offset:
          raise ValueError('Expect start offset %s, got %s' %
                           (gcs_file.next_offset, start),
                           httplib.REQUESTED_RANGE_NOT_SATISFIABLE)

        elif end != gcs_file.next_offset:
          return
        else:

          content = content[gcs_file.next_offset - start:]
          start = gcs_file.next_offset
          blobkey = '%s-%d-%d' % (token, start, end)
          self.blob_storage.StoreBlob(blobkey, StringIO.StringIO(content))
          new_content = _AE_GCSPartialFile_(
              parent=gcs_file,

              key_name='%020d' % start,
              partial_content=blobkey,
              start=start,
              end=end + 1)
          new_content.put()
          gcs_file.next_offset = end + 1
          gcs_file.put()
      if length is not None and length != gcs_file.next_offset:
        raise ValueError(
            'Got finalization request with wrong file length. '
            'Expecting %s, got %s' % (gcs_file.next_offset, length),
            httplib.REQUESTED_RANGE_NOT_SATISFIABLE)
      elif length is not None:
        return self._end_creation(token, _upload_filename)
    finally:
      namespace_manager.set_namespace(ns)
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/cloudstorage/cloudstorage_stub.py/CloudStorageStub.put_continue_creation/operator `<` -> `!=`