MCPcopy Index your code
hub / github.com/s3tools/s3cmd / compose_batch_del_xml

Method compose_batch_del_xml

S3/S3.py:862–876  ·  view source on GitHub ↗
(bucket, key_list)

Source from the content-addressed store, hash-verified

860 def object_batch_delete_uri_strs(self, uris):
861 """ Batch delete given a list of object uris """
862 def compose_batch_del_xml(bucket, key_list):
863 body = u"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Delete>"
864 for key in key_list:
865 uri = S3Uri(key)
866 if uri.type != "s3":
867 raise ValueError("Expected URI type 's3', got '%s'" % uri.type)
868 if not uri.has_object():
869 raise ValueError("URI '%s' has no object" % key)
870 if uri.bucket() != bucket:
871 raise ValueError("The batch should contain keys from the same bucket")
872 object = saxutils.escape(uri.object())
873 body += u"<Object><Key>%s</Key></Object>" % object
874 body += u"</Delete>"
875 body = encode_to_s3(body)
876 return body
877
878 batch = uris
879 if len(batch) == 0:

Callers

nothing calls this directly

Calls 5

S3UriClass · 0.90
encode_to_s3Function · 0.85
has_objectMethod · 0.80
bucketMethod · 0.80
objectMethod · 0.80

Tested by

no test coverage detected