Merge "py3: start porting for unit/proxy/test_server.py"
This commit is contained in:
commit
4aa33a2cc2
@ -270,9 +270,9 @@ class ContainerController(Controller):
|
||||
str(config_true_value(req.headers['X-Container-Sharding']))
|
||||
length_limit = self.get_name_length_limit()
|
||||
if len(self.container_name) > length_limit:
|
||||
resp = HTTPBadRequest(request=req)
|
||||
resp.body = 'Container name length of %d longer than %d' % \
|
||||
(len(self.container_name), length_limit)
|
||||
body = 'Container name length of %d longer than %d' % (
|
||||
len(self.container_name), length_limit)
|
||||
resp = HTTPBadRequest(request=req, body=body)
|
||||
return resp
|
||||
account_partition, accounts, container_count = \
|
||||
self.account_info(self.account_name, req)
|
||||
@ -289,9 +289,9 @@ class ContainerController(Controller):
|
||||
self.container_info(self.account_name, self.container_name,
|
||||
req)
|
||||
if not is_success(container_info.get('status')):
|
||||
resp = HTTPForbidden(request=req)
|
||||
resp.body = 'Reached container limit of %s' % \
|
||||
self.app.max_containers_per_account
|
||||
body = 'Reached container limit of %s' % (
|
||||
self.app.max_containers_per_account, )
|
||||
resp = HTTPForbidden(request=req, body=body)
|
||||
return resp
|
||||
container_partition, containers = self.app.container_ring.get_nodes(
|
||||
self.account_name, self.container_name)
|
||||
|
@ -115,7 +115,7 @@ class ProxyOverrideOptions(object):
|
||||
except ValueError as err:
|
||||
# make the message a little more useful
|
||||
raise ValueError("Invalid read_affinity value: %r (%s)" %
|
||||
(self.read_affinity, err.message))
|
||||
(self.read_affinity, err.args[0]))
|
||||
|
||||
self.write_affinity = get('write_affinity', '')
|
||||
try:
|
||||
@ -124,7 +124,7 @@ class ProxyOverrideOptions(object):
|
||||
except ValueError as err:
|
||||
# make the message a little more useful
|
||||
raise ValueError("Invalid write_affinity value: %r (%s)" %
|
||||
(self.write_affinity, err.message))
|
||||
(self.write_affinity, err.args[0]))
|
||||
self.write_affinity_node_count = get(
|
||||
'write_affinity_node_count', '2 * replicas').lower()
|
||||
value = self.write_affinity_node_count.split()
|
||||
@ -309,7 +309,7 @@ class Application(object):
|
||||
(label_for_policy, override))
|
||||
return override
|
||||
except ValueError as err:
|
||||
raise ValueError(err.message + ' for %s' % label_for_policy)
|
||||
raise ValueError('%s for %s' % (err, label_for_policy))
|
||||
|
||||
def _load_per_policy_config(self, conf):
|
||||
"""
|
||||
|
@ -906,7 +906,7 @@ def fake_http_connect(*code_iter, **kwargs):
|
||||
# if we're going to be slow, we need a body to send slowly
|
||||
am_slow, _junk = self.get_slow()
|
||||
if am_slow and len(self.body) < self.SLOW_READS:
|
||||
self.body += " " * (self.SLOW_READS - len(self.body))
|
||||
self.body += b" " * (self.SLOW_READS - len(self.body))
|
||||
|
||||
# be nice to trixy bits with node_iter's
|
||||
eventlet.sleep()
|
||||
@ -983,7 +983,7 @@ def fake_http_connect(*code_iter, **kwargs):
|
||||
am_slow, value = self.get_slow()
|
||||
if am_slow:
|
||||
if self.sent < self.SLOW_READS:
|
||||
slowly_read_byte = self.body[self.sent]
|
||||
slowly_read_byte = self.body[self.sent:self.sent + 1]
|
||||
self.sent += 1
|
||||
eventlet.sleep(value)
|
||||
return slowly_read_byte
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user