Python 3: Don't use BaseException.message attribute

In Python 3, BaseException.message is removed.
So we use args attribute instead.

Change-Id: Ief654970cb29e88c21add1c3d4235b86ddc0b94e
Related-Change-Id: I8f97c0b0452f348acef20e9d248f02b83cec2562
This commit is contained in:
fumihiko kakuma 2016-07-08 10:29:47 +09:00
parent 1c22158672
commit 791daad1bd

View File

@ -40,7 +40,7 @@ def deep_format(obj, paramdict, allow_empty=False):
else: else:
ret = CustomFormatter(allow_empty).format(obj, **paramdict) ret = CustomFormatter(allow_empty).format(obj, **paramdict)
except KeyError as exc: except KeyError as exc:
missing_key = exc.message missing_key = exc.args[0]
desc = "%s parameter missing to format %s\nGiven:\n%s" % ( desc = "%s parameter missing to format %s\nGiven:\n%s" % (
missing_key, obj, pformat(paramdict)) missing_key, obj, pformat(paramdict))
raise JenkinsJobsException(desc) raise JenkinsJobsException(desc)
@ -55,7 +55,7 @@ def deep_format(obj, paramdict, allow_empty=False):
ret[CustomFormatter(allow_empty).format(item, **paramdict)] = \ ret[CustomFormatter(allow_empty).format(item, **paramdict)] = \
deep_format(obj[item], paramdict, allow_empty) deep_format(obj[item], paramdict, allow_empty)
except KeyError as exc: except KeyError as exc:
missing_key = exc.message missing_key = exc.args[0]
desc = "%s parameter missing to format %s\nGiven:\n%s" % ( desc = "%s parameter missing to format %s\nGiven:\n%s" % (
missing_key, obj, pformat(paramdict)) missing_key, obj, pformat(paramdict))
raise JenkinsJobsException(desc) raise JenkinsJobsException(desc)