New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance __repr__ method of Principal #275
Conversation
|
|
||
| def __repr__(self): | ||
| return "{}.{}('{}')".format( | ||
| self.__module__, self.__class__.__name__, self.__str__()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- does it actually work? Usually instances don't have a
__module__attribute, only classes. - don't call
self.__str__() - where is the unit test? :)
Something like this should work
def __repr__(self):
return "{0.__module__}.{0.__name__}('{1}')".format(
self.__class__, self)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please see inline comments
7f4f4bc
to
a774038
Compare
|
Sorry I somehow botched that, but it worked nevertheless. I have re-worked the PR according to your comments. |
|
Can you please add a test to |
`__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
a774038
to
53a2e9d
Compare
|
That sound like a good idea. Added such assert to the unit tests. |
|
Fixed upstream |
__repr__now returns more descriptive string containing the actual principalname 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