diff --git a/swift/common/middleware/s3api/etree.py b/swift/common/middleware/s3api/etree.py index 29adbc38ed..987b84a144 100644 --- a/swift/common/middleware/s3api/etree.py +++ b/swift/common/middleware/s3api/etree.py @@ -92,7 +92,7 @@ def tostring(tree, use_s3ns=True, xml_declaration=True): root = Element(tree.tag, attrib=tree.attrib, nsmap=nsmap) root.text = tree.text - root.extend(deepcopy(tree.getchildren())) + root.extend(deepcopy(list(tree))) tree = root return lxml.etree.tostring(tree, xml_declaration=xml_declaration, diff --git a/test/functional/s3api/test_versioning.py b/test/functional/s3api/test_versioning.py index bbbb72a70b..bd80a95809 100644 --- a/test/functional/s3api/test_versioning.py +++ b/test/functional/s3api/test_versioning.py @@ -58,7 +58,7 @@ class TestS3ApiVersioning(S3ApiBase): 'GET', 'bucket', query='versioning') self.assertEqual(status, 200) elem = fromstring(body) - self.assertEqual(elem.getchildren(), []) + self.assertEqual(list(elem), []) # Enable versioning elem = Element('VersioningConfiguration') @@ -108,7 +108,7 @@ class TestS3ApiVersioning(S3ApiBase): 'GET', 'bucket', query='versioning') self.assertEqual(status, 200) elem = fromstring(body) - self.assertEqual(elem.getchildren(), []) + self.assertEqual(list(elem), []) # Suspend versioning elem = Element('VersioningConfiguration') diff --git a/test/unit/common/middleware/s3api/test_versioning.py b/test/unit/common/middleware/s3api/test_versioning.py index 33acd82b3c..ed485b9133 100644 --- a/test/unit/common/middleware/s3api/test_versioning.py +++ b/test/unit/common/middleware/s3api/test_versioning.py @@ -42,7 +42,7 @@ class TestS3ApiVersioning(S3ApiTestCase): status, headers, body = self._versioning_GET(path) self.assertEqual(status.split()[0], '200') elem = fromstring(body, 'VersioningConfiguration') - self.assertEqual(elem.getchildren(), []) + self.assertEqual(list(elem), []) def _versioning_GET_enabled(self, path): self.swift.register('HEAD', '/v1/AUTH_test/bucket', HTTPNoContent, {