Files
python-cinderclient/cinderclient/tests/unit/test_exceptions.py
Matt Riedemann 03542ee65a Fix ClientException init when there is no message on py34
BaseException.message was removed in python 3 per PEP 0352 so if no
message is passed to the ClientException __init__ it will blow up:

AttributeError: type object 'ClientException' has no attribute 'message'

So this change does two things:

1. Default to 'n/a' for message and details when body['keys'] doesn't
   have a message or details in it (which should be fine since
   from_response defaults to n/a if 'keys' is not in body).
2. Use getattr for self.__class__.message and default to None if that
   attribute is not set.  Arguably we could just remove this and make
   the message kwarg default to 'n/a' in ClientException.__init__ but
   I figured that was more invasive.

Closes-Bug: #1481478

Change-Id: I738cb9c8d4f015048c45a1df16bf18e29190e392
2015-08-04 14:21:52 -07:00

1.2 KiB