mbasti-rh's pull request #53: "Fix ScriptError to always return string from 
__str__" was opened

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

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

See the full pull-request at https://github.com/freeipa/freeipa/pull/53
... or pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/53/head:pr53
git checkout pr53
From 91fa88fb96655ef769677dcaee89c7cb30cbddff Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Mon, 5 Sep 2016 13:15:30 +0200
Subject: [PATCH] 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
---
 ipapython/admintool.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipapython/admintool.py b/ipapython/admintool.py
index e40f300..ec0e7e0 100644
--- a/ipapython/admintool.py
+++ b/ipapython/admintool.py
@@ -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):
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to