diff options
| author | Christian Heimes <cheimes@redhat.com> | 2015-07-15 11:11:35 +0200 |
|---|---|---|
| committer | Christian Heimes <cheimes@redhat.com> | 2015-08-10 11:58:44 +0200 |
| commit | 1738f27d3683d58b3ab023724eb8d0133c428eef (patch) | |
| tree | b45ef3fe9ccea6121f29b7b10c8eca5cf1ea0967 /base/common/python/pki | |
| parent | 8ae5ec7f3774d81a1c3d79c2a05649de65b8658c (diff) | |
| download | pki-1738f27d3683d58b3ab023724eb8d0133c428eef.tar.gz pki-1738f27d3683d58b3ab023724eb8d0133c428eef.tar.xz pki-1738f27d3683d58b3ab023724eb8d0133c428eef.zip | |
Replace Exception.message with str(exc)
Python 3 has deprecated and remove Exception.message. Instead we should
simply use string formatting to print the message of an Exception.
>>> import pki
>>> pki.PKIException('msg')
PKIException('msg',)
>>> pki.PKIException('msg').message
'msg'
>>> str(pki.PKIException('msg'))
'msg'
>>> '%s' % pki.PKIException('msg')
'msg'
Diffstat (limited to 'base/common/python/pki')
| -rw-r--r-- | base/common/python/pki/upgrade.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/base/common/python/pki/upgrade.py b/base/common/python/pki/upgrade.py index 5534069c1..30911613a 100644 --- a/base/common/python/pki/upgrade.py +++ b/base/common/python/pki/upgrade.py @@ -307,7 +307,7 @@ class PKIUpgradeScriptlet(object): if verbose: traceback.print_exc() else: - print 'ERROR: ' + e.message + print 'ERROR: %s' % e message = 'Failed upgrading system.' if self.upgrader.silent: @@ -320,7 +320,7 @@ class PKIUpgradeScriptlet(object): if result == 'y': return - raise pki.PKIException('Upgrade failed: ' + e.message, e) + raise pki.PKIException('Upgrade failed: %s' % e, e) def revert(self): @@ -631,7 +631,7 @@ class PKIUpgrader(object): if verbose: traceback.print_exc() else: - print e.message + print e print @@ -693,12 +693,12 @@ class PKIUpgrader(object): print - message = 'Revert failed: ' + e.message + message = 'Revert failed: %s' % e if verbose: traceback.print_exc() else: - print e.message + print e print |
