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):
|
||||
return Response(status='507 %s is not mounted' % drive)
|
||||
try:
|
||||
args = simplejson.load(req.body_file)
|
||||
args = simplejson.load(req.environ['wsgi.input'])
|
||||
except ValueError, err:
|
||||
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
||||
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):
|
||||
return Response(status='507 %s is not mounted' % drive)
|
||||
try:
|
||||
args = simplejson.load(req.body_file)
|
||||
args = simplejson.load(req.environ['wsgi.input'])
|
||||
except ValueError, err:
|
||||
return HTTPBadRequest(body=str(err), content_type='text/plain')
|
||||
ret = self.replicator_rpc.dispatch(post_args, args)
|
||||
|
@ -383,8 +383,8 @@ class ObjectController(object):
|
||||
with file.mkstemp() as (fd, tmppath):
|
||||
if 'content-length' in request.headers:
|
||||
fallocate(fd, int(request.headers['content-length']))
|
||||
for chunk in iter(lambda: request.body_file.read(
|
||||
self.network_chunk_size), ''):
|
||||
reader = request.environ['wsgi.input'].read
|
||||
for chunk in iter(lambda: reader(self.network_chunk_size), ''):
|
||||
upload_size += len(chunk)
|
||||
if time.time() > upload_expiration:
|
||||
return HTTPRequestTimeout(request=request)
|
||||
|
@ -929,8 +929,8 @@ class ObjectController(Controller):
|
||||
error_response = check_object_creation(req, self.object_name)
|
||||
if error_response:
|
||||
return error_response
|
||||
data_source = \
|
||||
iter(lambda: req.body_file.read(self.app.client_chunk_size), '')
|
||||
reader = req.environ['wsgi.input'].read
|
||||
data_source = iter(lambda: reader(self.app.client_chunk_size), '')
|
||||
source_header = req.headers.get('X-Copy-From')
|
||||
if source_header:
|
||||
source_header = unquote(source_header)
|
||||
|
@ -835,9 +835,9 @@ class TestObjectController(unittest.TestCase):
|
||||
def test_status_map(statuses, expected):
|
||||
self.app.memcache.store = {}
|
||||
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)
|
||||
req.body_file = StringIO('some data')
|
||||
res = controller.PUT(req)
|
||||
expected = str(expected)
|
||||
self.assertEquals(res.status[:len(expected)], expected)
|
||||
|
Loading…
Reference in New Issue
Block a user