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:
|
try:
|
||||||
path = path.encode("utf-8")
|
path = path.encode("utf-8")
|
||||||
except UnicodeError, e:
|
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)
|
path = quote('/' + device + '/' + str(partition) + path)
|
||||||
return http_connect_raw(
|
return http_connect_raw(
|
||||||
ipaddr, port, method, path, headers, query_string, ssl)
|
ipaddr, port, method, path, headers, query_string, ssl)
|
||||||
|
@ -719,7 +719,7 @@ class ObjectController(object):
|
|||||||
try:
|
try:
|
||||||
fsize = request.message_length()
|
fsize = request.message_length()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return HTTPBadRequest(body=e.message, request=request,
|
return HTTPBadRequest(body=str(e), request=request,
|
||||||
content_type='text/plain')
|
content_type='text/plain')
|
||||||
if self.mount_check and not check_mount(self.devices, device):
|
if self.mount_check and not check_mount(self.devices, device):
|
||||||
return HTTPInsufficientStorage(drive=device, request=request)
|
return HTTPInsufficientStorage(drive=device, request=request)
|
||||||
|
@ -707,10 +707,10 @@ class ObjectController(Controller):
|
|||||||
ml = req.message_length()
|
ml = req.message_length()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return HTTPBadRequest(request=req, content_type='text/plain',
|
return HTTPBadRequest(request=req, content_type='text/plain',
|
||||||
body=e.message)
|
body=str(e))
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
return HTTPNotImplemented(request=req, content_type='text/plain',
|
return HTTPNotImplemented(request=req, content_type='text/plain',
|
||||||
body=e.message)
|
body=str(e))
|
||||||
if ml is not None and ml > MAX_FILE_SIZE:
|
if ml is not None and ml > MAX_FILE_SIZE:
|
||||||
return HTTPRequestEntityTooLarge(request=req)
|
return HTTPRequestEntityTooLarge(request=req)
|
||||||
if 'x-delete-after' in req.headers:
|
if 'x-delete-after' in req.headers:
|
||||||
|
@ -590,7 +590,7 @@ class TestRequest(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
l = req.message_length()
|
l = req.message_length()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.assertEquals(e.message, "Invalid Content-Length header value")
|
self.assertEquals(str(e), "Invalid Content-Length header value")
|
||||||
else:
|
else:
|
||||||
self.fail("Expected a ValueError raised for 'abc'")
|
self.fail("Expected a ValueError raised for 'abc'")
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ class TestRequest(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
l = req.message_length()
|
l = req.message_length()
|
||||||
except AttributeError as e:
|
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")
|
" value specified in Transfer-Encoding header")
|
||||||
else:
|
else:
|
||||||
self.fail("Expected an AttributeError raised for 'gzip'")
|
self.fail("Expected an AttributeError raised for 'gzip'")
|
||||||
@ -615,7 +615,7 @@ class TestRequest(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
l = req.message_length()
|
l = req.message_length()
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.assertEquals(e.message, "Invalid Transfer-Encoding header value")
|
self.assertEquals(str(e), "Invalid Transfer-Encoding header value")
|
||||||
else:
|
else:
|
||||||
self.fail("Expected a ValueError raised for 'gzip'")
|
self.fail("Expected a ValueError raised for 'gzip'")
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ class TestRequest(unittest.TestCase):
|
|||||||
try:
|
try:
|
||||||
l = req.message_length()
|
l = req.message_length()
|
||||||
except AttributeError as e:
|
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")
|
" value specified in Transfer-Encoding header")
|
||||||
else:
|
else:
|
||||||
self.fail("Expected an AttributeError raised for 'gzip,identity'")
|
self.fail("Expected an AttributeError raised for 'gzip,identity'")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user