Ejemplo n.º 1
0
def delete_async(blob_keys, rpc=None, _token=None):
  """Delete a blob from Blobstore -- async version.

  Args:
    blob_keys: Single instance or list of blob keys.  A blob-key can be either
      a string or an instance of BlobKey.
    rpc: Optional UserRPC object.

  Returns:
    A UserRPC whose result will be None.
  """



  if isinstance(blob_keys, (six.string_types, BlobKey)):
    blob_keys = [blob_keys]
  request = blobstore_service_pb.DeleteBlobRequest()
  for blob_key in blob_keys:
    request.add_blob_key(str(blob_key))
  if _token:
    request.set_token(_token)
  response = api_base_pb.VoidProto()

  return _make_async_call(rpc, 'DeleteBlob', request, response,
                          _get_result_hook, lambda rpc: None)
Ejemplo n.º 2
0
def delete_async(blob_keys, rpc=None, _token=None):
  """Asynchronously deletes a blob from Blobstore.

  Args:
    blob_keys: A single `BlobKey` instance or a list of blob keys. A blob key
        can be either a string or an instance of `BlobKey`.
    rpc: Optional UserRPC object.

  Returns:
    A UserRPC, whose result will be `None`.
  """



  if isinstance(blob_keys, (basestring, BlobKey)):
    blob_keys = [blob_keys]
  request = blobstore_service_pb.DeleteBlobRequest()
  for blob_key in blob_keys:
    request.add_blob_key(str(blob_key))
  if _token:
    request.set_token(_token)
  response = api_base_pb.VoidProto()

  return _make_async_call(rpc, 'DeleteBlob', request, response,
                          _get_result_hook, lambda rpc: None)
Ejemplo n.º 3
0
def delete(blob_keys, _make_sync_call=apiproxy_stub_map.MakeSyncCall):
    """Delete a blob from Blobstore.

  Args:
    blob_keys: Single instance or list of blob keys.  A blob-key can be either
      a string or an instance of BlobKey.
    _make_sync_call: Used for dependency injection in tests.
  """
    if isinstance(blob_keys, (basestring, BlobKey)):
        blob_keys = [blob_keys]
    request = blobstore_service_pb.DeleteBlobRequest()
    for blob_key in blob_keys:
        request.add_blob_key(str(blob_key))
    response = api_base_pb.VoidProto()
    try:
        _make_sync_call('blobstore', 'DeleteBlob', request, response)
    except apiproxy_errors.ApplicationError, e:
        raise _ToBlobstoreError(e)