Improve LDAPEntry.__repr__ for freshly created entries

Creating a LDAPEntry from dict does not set the raw entries,
to display everything we need to combine the underlying data.

https://fedorahosted.org/freeipa/ticket/4015
This commit is contained in:
Petr Viktorin 2013-11-06 12:40:02 +01:00
parent f20577ddc4
commit 76c7f24919

View File

@ -719,7 +719,9 @@ class LDAPEntry(collections.MutableMapping):
return self._orig
def __repr__(self):
return '%s(%r, %r)' % (type(self).__name__, self._dn, self._raw)
data = dict(self._raw)
data.update((k, v) for k, v in self._nice.iteritems() if v is not None)
return '%s(%r, %r)' % (type(self).__name__, self._dn, data)
def copy(self):
return LDAPEntry(self)