ipaldap: preserve order of values in LDAPEntry._sync()

In Python 2, the order was preserved by accident.

This change makes sure the order is preserved in both Python 2 and 3.

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Jan Cholasta
2017-02-07 14:11:24 +01:00
committed by Martin Basti
parent b20f6fb294
commit e920ae2252

View File

@@ -292,13 +292,13 @@ class LDAPEntry(collections.MutableMapping):
continue continue
nice.remove(value) nice.remove(value)
for value in nice_adds: for value in sorted(nice_adds, key=nice.index):
value = self._conn.encode(value) value = self._conn.encode(value)
if value in raw_dels: if value in raw_dels:
continue continue
raw.append(value) raw.append(value)
for value in raw_adds: for value in sorted(raw_adds, key=raw.index):
try: try:
value = self._conn.decode(value, name) value = self._conn.decode(value, name)
except ValueError as e: except ValueError as e: