Replaced <exc>.message with str(<exc>)
Change-Id: I9a030b84dafe2b2300e8735052f6f15f34bc7aa7
This commit is contained in:
parent
e331947374
commit
98ea844478
@ -130,7 +130,7 @@ def http_connect(ipaddr, port, device, partition, method, path,
|
||||
try:
|
||||
path = path.encode("utf-8")
|
||||
except UnicodeError, e:
|
||||
logging.exception(_('Error encoding to UTF-8: %s'), e.message)
|
||||
logging.exception(_('Error encoding to UTF-8: %s'), str(e))
|
||||
path = quote('/' + device + '/' + str(partition) + path)
|
||||
return http_connect_raw(
|
||||
ipaddr, port, method, path, headers, query_string, ssl)
|
||||
|
@ -719,7 +719,7 @@ class ObjectController(object):
|
||||
try:
|
||||
fsize = request.message_length()
|
||||
except ValueError as e:
|
||||
return HTTPBadRequest(body=e.message, request=request,
|
||||
return HTTPBadRequest(body=str(e), request=request,
|
||||
content_type='text/plain')
|
||||
if self.mount_check and not check_mount(self.devices, device):
|
||||
return HTTPInsufficientStorage(drive=device, request=request)
|
||||
|
@ -707,10 +707,10 @@ class ObjectController(Controller):
|
||||
ml = req.message_length()
|
||||
except ValueError as e:
|
||||
return HTTPBadRequest(request=req, content_type='text/plain',
|
||||
body=e.message)
|
||||
body=str(e))
|
||||
except AttributeError as e:
|
||||
return HTTPNotImplemented(request=req, content_type='text/plain',
|
||||
body=e.message)
|
||||
body=str(e))
|
||||
if ml is not None and ml > MAX_FILE_SIZE:
|
||||
return HTTPRequestEntityTooLarge(request=req)
|
||||
if 'x-delete-after' in req.headers:
|
||||
|
@ -590,7 +590,7 @@ class TestRequest(unittest.TestCase):
|
||||
try:
|
||||
l = req.message_length()
|
||||
except ValueError as e:
|
||||
self.assertEquals(e.message, "Invalid Content-Length header value")
|
||||
self.assertEquals(str(e), "Invalid Content-Length header value")
|
||||
else:
|
||||
self.fail("Expected a ValueError raised for 'abc'")
|
||||
|
||||
@ -606,7 +606,7 @@ class TestRequest(unittest.TestCase):
|
||||
try:
|
||||
l = req.message_length()
|
||||
except AttributeError as e:
|
||||
self.assertEquals(e.message, "Unsupported Transfer-Coding header"
|
||||
self.assertEquals(str(e), "Unsupported Transfer-Coding header"
|
||||
" value specified in Transfer-Encoding header")
|
||||
else:
|
||||
self.fail("Expected an AttributeError raised for 'gzip'")
|
||||
@ -615,7 +615,7 @@ class TestRequest(unittest.TestCase):
|
||||
try:
|
||||
l = req.message_length()
|
||||
except ValueError as e:
|
||||
self.assertEquals(e.message, "Invalid Transfer-Encoding header value")
|
||||
self.assertEquals(str(e), "Invalid Transfer-Encoding header value")
|
||||
else:
|
||||
self.fail("Expected a ValueError raised for 'gzip'")
|
||||
|
||||
@ -623,7 +623,7 @@ class TestRequest(unittest.TestCase):
|
||||
try:
|
||||
l = req.message_length()
|
||||
except AttributeError as e:
|
||||
self.assertEquals(e.message, "Unsupported Transfer-Coding header"
|
||||
self.assertEquals(str(e), "Unsupported Transfer-Coding header"
|
||||
" value specified in Transfer-Encoding header")
|
||||
else:
|
||||
self.fail("Expected an AttributeError raised for 'gzip,identity'")
|
||||
|
Loading…
Reference in New Issue
Block a user