From 38cc40ddb5bf965801500bb4f66fd965b12e3c88 Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Mon, 28 Nov 2016 10:22:26 +0100 Subject: Enhance __repr__ method of Principal `__repr__` now returns more descriptive string containing the actual principal name while keeping the ability to reconstruct the object from it. This makes principal names visible in debug logs, easing troubleshooting a bit. https://fedorahosted.org/freeipa/ticket/6505 Reviewed-By: Christian Heimes --- ipapython/kerberos.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ipapython') diff --git a/ipapython/kerberos.py b/ipapython/kerberos.py index a8ebc0428..3d3530c9c 100644 --- a/ipapython/kerberos.py +++ b/ipapython/kerberos.py @@ -181,3 +181,7 @@ class Principal(object): principal_string = u'@'.join([principal_string, realm]) return principal_string + + def __repr__(self): + return "{0.__module__}.{0.__name__}('{1}')".format( + self.__class__, self) -- cgit