Skip to content

Commit

Permalink
Fix ScriptError to always return string from __str__
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MartinBasti committed Sep 5, 2016
1 parent 4ae4d0d commit 00d4309
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ipapython/admintool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 00d4309

Please sign in to comment.