Fixes to work with WebOb 1.0.1 and WebOb 1.0.3
This commit is contained in:
parent
a29b1da65c
commit
028ad1c613
@ -261,7 +261,7 @@ class AccountController(object):
|
|||||||
if self.mount_check and not check_mount(self.root, drive):
|
if self.mount_check and not check_mount(self.root, drive):
|
||||||
return Response(status='507 %s is not mounted' % drive)
|
return Response(status='507 %s is not mounted' % drive)
|
||||||
try:
|
try:
|
||||||
args = simplejson.load(req.body_file)
|
args = simplejson.load(req.environ['wsgi.input'])
|
||||||
except ValueError, err:
|
except ValueError, err:
|
||||||
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
||||||
ret = self.replicator_rpc.dispatch(post_args, args)
|
ret = self.replicator_rpc.dispatch(post_args, args)
|
||||||
|
@ -349,7 +349,7 @@ class ContainerController(object):
|
|||||||
if self.mount_check and not check_mount(self.root, drive):
|
if self.mount_check and not check_mount(self.root, drive):
|
||||||
return Response(status='507 %s is not mounted' % drive)
|
return Response(status='507 %s is not mounted' % drive)
|
||||||
try:
|
try:
|
||||||
args = simplejson.load(req.body_file)
|
args = simplejson.load(req.environ['wsgi.input'])
|
||||||
except ValueError, err:
|
except ValueError, err:
|
||||||
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
||||||
ret = self.replicator_rpc.dispatch(post_args, args)
|
ret = self.replicator_rpc.dispatch(post_args, args)
|
||||||
|
@ -383,8 +383,8 @@ class ObjectController(object):
|
|||||||
with file.mkstemp() as (fd, tmppath):
|
with file.mkstemp() as (fd, tmppath):
|
||||||
if 'content-length' in request.headers:
|
if 'content-length' in request.headers:
|
||||||
fallocate(fd, int(request.headers['content-length']))
|
fallocate(fd, int(request.headers['content-length']))
|
||||||
for chunk in iter(lambda: request.body_file.read(
|
reader = request.environ['wsgi.input'].read
|
||||||
self.network_chunk_size), ''):
|
for chunk in iter(lambda: reader(self.network_chunk_size), ''):
|
||||||
upload_size += len(chunk)
|
upload_size += len(chunk)
|
||||||
if time.time() > upload_expiration:
|
if time.time() > upload_expiration:
|
||||||
return HTTPRequestTimeout(request=request)
|
return HTTPRequestTimeout(request=request)
|
||||||
|
@ -929,8 +929,8 @@ class ObjectController(Controller):
|
|||||||
error_response = check_object_creation(req, self.object_name)
|
error_response = check_object_creation(req, self.object_name)
|
||||||
if error_response:
|
if error_response:
|
||||||
return error_response
|
return error_response
|
||||||
data_source = \
|
reader = req.environ['wsgi.input'].read
|
||||||
iter(lambda: req.body_file.read(self.app.client_chunk_size), '')
|
data_source = iter(lambda: reader(self.app.client_chunk_size), '')
|
||||||
source_header = req.headers.get('X-Copy-From')
|
source_header = req.headers.get('X-Copy-From')
|
||||||
if source_header:
|
if source_header:
|
||||||
source_header = unquote(source_header)
|
source_header = unquote(source_header)
|
||||||
|
@ -835,9 +835,9 @@ class TestObjectController(unittest.TestCase):
|
|||||||
def test_status_map(statuses, expected):
|
def test_status_map(statuses, expected):
|
||||||
self.app.memcache.store = {}
|
self.app.memcache.store = {}
|
||||||
proxy_server.http_connect = mock_http_connect(*statuses)
|
proxy_server.http_connect = mock_http_connect(*statuses)
|
||||||
req = Request.blank('/a/c/o.jpg', {})
|
req = Request.blank('/a/c/o.jpg',
|
||||||
|
environ={'REQUEST_METHOD': 'PUT'}, body='some data')
|
||||||
self.app.update_request(req)
|
self.app.update_request(req)
|
||||||
req.body_file = StringIO('some data')
|
|
||||||
res = controller.PUT(req)
|
res = controller.PUT(req)
|
||||||
expected = str(expected)
|
expected = str(expected)
|
||||||
self.assertEquals(res.status[:len(expected)], expected)
|
self.assertEquals(res.status[:len(expected)], expected)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user