Fix ScriptError to always return string from __str__

Use super for proper handling of exceptions. msg property was added due
compatibility with the current code.

https://fedorahosted.org/freeipa/ticket/6294

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
This commit is contained in:
Martin Basti
2016-09-05 13:15:30 +02:00
parent 4ae4d0d690
commit 00d43095da

View File

@@ -38,11 +38,12 @@ class ScriptError(Exception):
def __init__(self, msg='', rval=1):
if msg is None:
msg = ''
self.msg = msg
super(ScriptError, self).__init__(msg)
self.rval = rval
def __str__(self):
return self.msg
@property
def msg(self):
return str(self)
class AdminTool(object):