Fix delete keys with werkzeug request

This commit is contained in:
Daniel Miller 2016-01-22 12:44:57 -05:00
parent 89d5c72d86
commit 35a89da273

View File

@ -121,7 +121,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
elif method == 'DELETE':
return self._bucket_response_delete(body, bucket_name, querystring, headers)
elif method == 'POST':
return self._bucket_response_post(request, bucket_name, headers)
return self._bucket_response_post(request, body, bucket_name, headers)
else:
raise NotImplementedError("Method {0} has not been impelemented in the S3 backend yet".format(method))
@ -268,9 +268,9 @@ class ResponseObject(_TemplateEnvironmentMixin):
template = self.response_template(S3_DELETE_BUCKET_WITH_ITEMS_ERROR)
return 409, headers, template.render(bucket=removed_bucket)
def _bucket_response_post(self, request, bucket_name, headers):
def _bucket_response_post(self, request, body, bucket_name, headers):
if self.is_delete_keys(request, request.path, bucket_name):
return self._bucket_response_delete_keys(request, bucket_name, headers)
return self._bucket_response_delete_keys(request, body, bucket_name, headers)
# POST to bucket-url should create file from form
if hasattr(request, 'form'):
@ -297,10 +297,10 @@ class ResponseObject(_TemplateEnvironmentMixin):
return 200, headers, ""
def _bucket_response_delete_keys(self, request, bucket_name, headers):
def _bucket_response_delete_keys(self, request, body, bucket_name, headers):
template = self.response_template(S3_DELETE_KEYS_RESPONSE)
keys = minidom.parseString(request.body.decode('utf-8')).getElementsByTagName('Key')
keys = minidom.parseString(body).getElementsByTagName('Key')
deleted_names = []
error_names = []