[Freeipa-devel] [PATCH] 0317 Improve LDAPEntry.__repr__ for freshly created entries

Jan Cholasta jcholast at redhat.com
Tue Nov 26 08:57:28 UTC 2013


On 25.11.2013 14:41, Petr Viktorin wrote:
> On 11/25/2013 01:05 PM, Jan Cholasta wrote:
>> On 6.11.2013 13:28, Petr Viktorin wrote:
>>> Hello Honza,
>>> This is a simple enough patch, but I'd like you to check if it's
>>> consistent with your vision of the framework.
>>>
>>
>> I used self._raw here deliberately, so that calling repr() on an
>> LDAPEntry does not change its internal state.
>>
>> I agree that using self._raw alone is insufficient, but I'd like to keep
>> the "no changes" behavior, perhaps using something like this:
>>
>>      data = dict(self._raw)
>>      data.update(self._nice)
>>      return '%s(%r, %r)' % (type(self).__name__, self._dn, data)
>
> That makes sense.
> Newly created entries have None values in _nice so I filtered them out
> here.
>

Nitpick: use iteritems() instead of items().

Besides that, ACK.

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list