Fix post-as-copy return code

This commit is contained in:
gholt 2011-07-13 22:31:55 +00:00 committed by Tarmac
commit 0509169851

View File

@ -33,7 +33,7 @@ from random import shuffle
from eventlet import sleep, GreenPile, Queue, TimeoutError
from eventlet.timeout import Timeout
from webob.exc import HTTPBadRequest, HTTPMethodNotAllowed, \
from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPMethodNotAllowed, \
HTTPNotFound, HTTPPreconditionFailed, \
HTTPRequestTimeout, HTTPServiceUnavailable, \
HTTPUnprocessableEntity, HTTPRequestEntityTooLarge, HTTPServerError, \
@ -891,7 +891,13 @@ class ObjectController(Controller):
req.headers['X-Copy-From'] = '/%s/%s' % (self.container_name,
self.object_name)
req.headers['X-Fresh-Metadata'] = 'true'
return self.PUT(req)
resp = self.PUT(req)
# Older editions returned 202 Accepted on object POSTs, so we'll
# convert any 201 Created responses to that for compatibility with
# picky clients.
if resp.status_int != 201:
return resp
return HTTPAccepted(request=req)
else:
error_response = check_metadata(req, 'object')
if error_response: